We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In code like this
fn a(v: &Vec<String>) { let _get_me_a_slice: &[String] = &v[..]; }
clippy will suggest passing v as slice instead of Vec, resulting in this refactoring:
Vec
fn a(v: &[String]) { let _get_me_a_slice: &[String] = &v[..]; }
But this means we are slicing the slice to get a slice, we can remove the [..] now!
[..]
fn a(v: &[String]) { let _get_me_a_slice: &[String] = v; }
It would be nice if clippy could warn about slicing of slices.
Kind: complexity?
What is the advantage of the recommended code over the original code
Simple code
None.
fn a(v: &[String]) { let _slice: &[String] = &v[..]; }
Could be written as:
fn a(v: &[String]) { let _slice: &[String] = v; }
The text was updated successfully, but these errors were encountered:
990e2b3
Successfully merging a pull request may close this issue.
What it does
In code like this
clippy will suggest passing v as slice instead of
Vec
, resulting in this refactoring:But this means we are slicing the slice to get a slice, we can remove the
[..]
now!It would be nice if clippy could warn about slicing of slices.
Categories (optional)
Kind: complexity?
What is the advantage of the recommended code over the original code
Simple code
Drawbacks
None.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: