-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Suggest usage of array and Vec .as_slice()
and .as_mut_slice()
methods
#8405
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @llogiq (or someone else) soon. Please see the contribution instructions for more information. |
.as_slice()
and .as_mut_slice()
methods
/// ``` | ||
#[clippy::version = "1.60.0"] | ||
pub MANUAL_SLICE, | ||
restriction, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about this.
let snip = snippet_with_context(cx, object.span, ctxt, "..", &mut app).0; | ||
let suggested_method = match mutability { | ||
Mutability::Not => "to_slice()", | ||
Mutability::Mut => "to_mut_slice()", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be as_slice
/as_mut_slice
A new lint called Also there has been a lot of discussion in #8218 about how this lint should be categoriezed (summary: restriction). |
@camsteffen fair enough, shall I abandon this PR and close the attached task? |
Yeah you can close this PR but let's leave the issue open until we have a lint that suggests |
Ok, makes sense. |
implements lint suggested in #7633
.stderr
file)cargo test
passes locallycargo dev update_lints
cargo dev fmt
Please write a short comment explaining your change (or "none" for internal only changes)
changelog: Add lint
[`manual_slice`]