mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Fix 'help' message
This commit is contained in:
parent
b69520f5fd
commit
e6811b9c26
2 changed files with 3 additions and 11 deletions
|
@ -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"))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue