We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8804753 commit d014c46Copy full SHA for d014c46
tests/ui/needless_path_new.rs
@@ -62,4 +62,12 @@ fn main() {
62
// we are conservative and don't suggest changing a parameter
63
// if it contains a generic type used elsewhere in the function
64
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
+ }
73
}
0 commit comments