mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 14:38:46 +00:00
weird thing
This commit is contained in:
parent
f6e0388e08
commit
e4b2a97401
2 changed files with 12 additions and 2 deletions
|
@ -1002,8 +1002,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CastPass {
|
|||
cx,
|
||||
FN_TO_NUMERIC_CAST,
|
||||
expr.span,
|
||||
&format!("casting a Fn to {} may truncate the function address value.", cast_to),
|
||||
"if you need address of function, use cast to `usize` instead:",
|
||||
&format!("casting a `{}` to `{}` may truncate the function address value.", cast_from, cast_to),
|
||||
// &format!("if you need address of function, use cast zz `usize`:"),
|
||||
&format!("if you need the address of the function, z consider:"),
|
||||
format!("{} as usize", &snippet(cx, ex.span, "x"))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,16 @@ enum Foo {
|
|||
B
|
||||
}
|
||||
|
||||
fn bar() -> i32 {
|
||||
0i32
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = Foo::A;
|
||||
let y = x as i32;
|
||||
|
||||
let z = bar as u32;
|
||||
|
||||
//let c = || {0i32};
|
||||
//let ac = c as u32;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue