-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New lint: needless Path::new
#14668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've never implemented a lint before, but would like to try implementing this one if it's deemed useful:) |
The same goes for wrapping in |
Reading through the guide, it looks like this lint will need to be late-pass, and so somewhat more complicated. The guide mentions |
A lint pass visits the whole crate, whenever the visitor sees an expression for example it calls The individual docs for |
Uh oh!
There was an error while loading. Please reload this page.
What it does
Checks whether a
&str
is wrapped inPath::new
before being passed to a function that acceptsimpl AsRef<Path>
. So somewhat similar to needless_borrowAdvantage
Drawbacks
can't think of any...
Example
Could be written as:
The text was updated successfully, but these errors were encountered: