Skip to content

Commit d014c46

Browse files
committed
wip
1 parent 8804753 commit d014c46

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/ui/needless_path_new.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,12 @@ fn main() {
6262
// we are conservative and don't suggest changing a parameter
6363
// if it contains a generic type used elsewhere in the function
6464
takes_two_impl_paths_with_the_same_generic(Path::new("foo"), Path::new("bar"));
65+
66+
// the type ascription specifies `Path`, not just `impl AsRef<Path>`
67+
let _: Option<&Path> = Some(Path::new("foo")); //~ needless_path_new
68+
69+
// the return type requires `Path`, not just `impl AsRef<Path>`
70+
fn foo() -> Option<&'static Path> {
71+
Some(Path::new("foo.txt"))
72+
}
6573
}

0 commit comments

Comments
 (0)