Skip to content

Commit 6808c2c

Browse files
committed
test: function stored in a variable
1 parent 9f9739d commit 6808c2c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/ui/needless_path_new.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use std::path::Path;
55

66
fn takes_path(_: &Path) {}
77

8+
fn takes_impl_path(_: impl AsRef<Path>) {}
9+
810
fn takes_path_and_impl_path(_: &Path, _: impl AsRef<Path>) {}
911

1012
fn takes_two_impl_paths_with_the_same_generic<P: AsRef<Path>>(_: P, _: P) {}
@@ -41,6 +43,10 @@ fn main() {
4143
Path::new("bar"), //~ needless_path_new
4244
);
4345

46+
let a = takes_impl_path;
47+
48+
a(Path::new("foo.txt")); //~ needless_path_new
49+
4450
// no warning
4551
takes_path(Path::new("foo"));
4652

0 commit comments

Comments
 (0)