]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/fn_to_numeric_cast.rs
iterate List by value
[rust.git] / tests / ui / fn_to_numeric_cast.rs
index fc8aa19dcf037c0b14025a0e24e6949994fc9fbd..a456c085c876108b618f77007aeb1d55f230abba 100644 (file)
@@ -1,9 +1,10 @@
-// only-64bit
-#![feature(tool_lints)]
+// ignore-32bit
 
 #![warn(clippy::fn_to_numeric_cast, clippy::fn_to_numeric_cast_with_truncation)]
 
-fn foo() -> String { String::new() }
+fn foo() -> String {
+    String::new()
+}
 
 fn test_function_to_numeric_cast() {
     let _ = foo as i8;
@@ -21,6 +22,10 @@ fn test_function_to_numeric_cast() {
 
     // Casting to usize is OK and should not warn
     let _ = foo as usize;
+
+    // Cast `f` (a `FnDef`) to `fn()` should not warn
+    fn f() {}
+    let _ = f as fn();
 }
 
 fn test_function_var_to_numeric_cast() {