From e6811b9c26726fa5c001c45c76b53137cf1570a3 Mon Sep 17 00:00:00 2001
From: Victor Korkin <victor.korkin@gmail.com>
Date: Wed, 30 May 2018 16:55:03 +0700
Subject: [PATCH] Fix 'help' message

---
 clippy_lints/src/types.rs       |  2 +-
 tests/ui/types_fn_to_int.stderr | 12 ++----------
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs
index fc65ebcc147..0fe5f24f8d4 100644
--- a/clippy_lints/src/types.rs
+++ b/clippy_lints/src/types.rs
@@ -1003,7 +1003,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CastPass {
                             FN_TO_NUMERIC_CAST,
                             expr.span,
                             &format!("casting a `{}` to `{}` may truncate the function address value.", cast_from, cast_to),
-                            "if you need the address of the function, consider :",
+                            "if you need the address of the function, consider",
                             format!("{} as usize", &snippet(cx, ex.span, "x"))
                         );
                     }
diff --git a/tests/ui/types_fn_to_int.stderr b/tests/ui/types_fn_to_int.stderr
index d5e8ad8bbb2..a3a1abcc681 100644
--- a/tests/ui/types_fn_to_int.stderr
+++ b/tests/ui/types_fn_to_int.stderr
@@ -2,23 +2,15 @@ error: casting a `fn(usize) -> Foo {Foo::A}` to `i32` may truncate the function
   --> $DIR/types_fn_to_int.rs:12:13
    |
 12 |     let y = x as i32;
-   |             ^^^^^^^^
+   |             ^^^^^^^^ help: if you need the address of the function, consider: `x as usize`
    |
    = note: #[deny(fn_to_numeric_cast)] on by default
-help: if you need the address of the function, consider :
-   |
-12 |     let y = x as usize;
-   |             ^^^^^^^^^^
 
 error: casting a `fn() -> i32 {bar}` to `u32` may truncate the function address value.
   --> $DIR/types_fn_to_int.rs:14:13
    |
 14 |     let z = bar as u32;
-   |             ^^^^^^^^^^
-help: if you need the address of the function, consider :
-   |
-14 |     let z = bar as usize;
-   |             ^^^^^^^^^^^^
+   |             ^^^^^^^^^^ help: if you need the address of the function, consider: `bar as usize`
 
 error: aborting due to 2 previous errors