]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/fn_to_numeric_cast.rs
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
[rust.git] / tests / ui / fn_to_numeric_cast.rs
index 6d0fd3d8ab8e88a60f461bef80ad3a23ca744a09..a456c085c876108b618f77007aeb1d55f230abba 100644 (file)
@@ -1,8 +1,10 @@
-#![feature(tool_lints)]
+// ignore-32bit
 
-#![warn(clippy::fn_to_numeric_cast)]
+#![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;
@@ -20,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() {