Skip to content

Commit b95ce0e

Browse files
committed
Auto merge of #8983 - Alexendoo:redundant_closure_tests, r=giraffate
Add tests for some fixed `redundant_closure` issues closes #7861 closes #5939 changelog: none
2 parents b3c94c0 + eae9c56 commit b95ce0e

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/ui/eta.fixed

+12
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,15 @@ fn coerced_closure() {
291291
fn slice_fn(_: impl FnOnce() -> &'static [u8]) {}
292292
slice_fn(|| arr());
293293
}
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+
}

tests/ui/eta.rs

+12
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,15 @@ fn coerced_closure() {
291291
fn slice_fn(_: impl FnOnce() -> &'static [u8]) {}
292292
slice_fn(|| arr());
293293
}
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+
}

0 commit comments

Comments
 (0)