mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-11 07:34:18 +00:00
Auto merge of #8983 - Alexendoo:redundant_closure_tests, r=giraffate
Add tests for some fixed `redundant_closure` issues closes #7861 closes #5939 changelog: none
This commit is contained in:
commit
b95ce0eada
2 changed files with 24 additions and 0 deletions
|
@ -291,3 +291,15 @@ fn coerced_closure() {
|
|||
fn slice_fn(_: impl FnOnce() -> &'static [u8]) {}
|
||||
slice_fn(|| arr());
|
||||
}
|
||||
|
||||
// https://github.com/rust-lang/rust-clippy/issues/7861
|
||||
fn box_dyn() {
|
||||
fn f(_: impl Fn(usize) -> Box<dyn std::any::Any>) {}
|
||||
f(|x| Box::new(x));
|
||||
}
|
||||
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5939
|
||||
fn not_general_enough() {
|
||||
fn f(_: impl FnMut(&Path) -> std::io::Result<()>) {}
|
||||
f(|path| std::fs::remove_file(path));
|
||||
}
|
||||
|
|
|
@ -291,3 +291,15 @@ fn coerced_closure() {
|
|||
fn slice_fn(_: impl FnOnce() -> &'static [u8]) {}
|
||||
slice_fn(|| arr());
|
||||
}
|
||||
|
||||
// https://github.com/rust-lang/rust-clippy/issues/7861
|
||||
fn box_dyn() {
|
||||
fn f(_: impl Fn(usize) -> Box<dyn std::any::Any>) {}
|
||||
f(|x| Box::new(x));
|
||||
}
|
||||
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5939
|
||||
fn not_general_enough() {
|
||||
fn f(_: impl FnMut(&Path) -> std::io::Result<()>) {}
|
||||
f(|path| std::fs::remove_file(path));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue