File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -291,3 +291,15 @@ fn coerced_closure() {
291
291
fn slice_fn(_: impl FnOnce() -> &'static [u8]) {}
292
292
slice_fn(|| arr());
293
293
}
294
+
295
+ // https://github.com/rust-lang/rust-clippy/issues/7861
296
+ fn box_dyn() {
297
+ fn f(_: impl Fn(usize) -> Box<dyn std::any::Any>) {}
298
+ f(|x| Box::new(x));
299
+ }
300
+
301
+ // https://github.com/rust-lang/rust-clippy/issues/5939
302
+ fn not_general_enough() {
303
+ fn f(_: impl FnMut(&Path) -> std::io::Result<()>) {}
304
+ f(|path| std::fs::remove_file(path));
305
+ }
Original file line number Diff line number Diff line change @@ -291,3 +291,15 @@ fn coerced_closure() {
291
291
fn slice_fn ( _: impl FnOnce ( ) -> & ' static [ u8 ] ) { }
292
292
slice_fn ( || arr ( ) ) ;
293
293
}
294
+
295
+ // https://github.com/rust-lang/rust-clippy/issues/7861
296
+ fn box_dyn ( ) {
297
+ fn f ( _: impl Fn ( usize ) -> Box < dyn std:: any:: Any > ) { }
298
+ f ( |x| Box :: new ( x) ) ;
299
+ }
300
+
301
+ // https://github.com/rust-lang/rust-clippy/issues/5939
302
+ fn not_general_enough ( ) {
303
+ fn f ( _: impl FnMut ( & Path ) -> std:: io:: Result < ( ) > ) { }
304
+ f ( |path| std:: fs:: remove_file ( path) ) ;
305
+ }
You can’t perform that action at this time.
0 commit comments