-
Notifications
You must be signed in to change notification settings - Fork 1.6k
make unwrap_used also trigger on .get().unwrap() #8125
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @giraffate (or someone else) soon. Please see the contribution instructions for more information. |
#[warn(clippy::get_unwrap)] | ||
fn unwrap_get2() { | ||
let v = vec![1, 2, 3]; | ||
let _ = v.get(0).unwrap(); | ||
} | ||
|
||
#[warn(clippy::get_unwrap)] | ||
fn unwrap_get_mut2() { | ||
let mut v = vec![1, 2, 3]; | ||
let _ = v.get_mut(0).unwrap(); | ||
} | ||
|
||
#[warn(clippy::get_unwrap)] | ||
#[allow(clippy::unwrap_used)] | ||
fn unwrap_get3() { | ||
let v = vec![1, 2, 3]; | ||
let _ = v.get(0).unwrap(); | ||
} | ||
|
||
#[warn(clippy::get_unwrap)] | ||
#[allow(clippy::unwrap_used)] | ||
fn unwrap_get_mut3() { | ||
let mut v = vec![1, 2, 3]; | ||
let _ = v.get_mut(0).unwrap(); | ||
} |
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.
You don't have to tet get_unwrap
in this file. It's tested in tests/ui/get_unwrap.rs
.
@doy ping from triage. There are still things that needs to be fixed. Any questions on how to proceed with this? |
☔ The latest upstream changes (presumably #8198) made this pull request unmergeable. Please resolve the merge conflicts. |
@doy ping from triage. According to the triage procedure, I'm closing this because 2 weeks have passed with no activity. If you have more time to work on this, feel free to reopen this. |
Hi. Can I make a new PR to complete this? |
Hey @tamaroning, sure that would be appreciated. You have also already assigned yourself to the issue. Let us know if you need any help :) 🙃 |
@rustbot label -S-inactive-closed |
Please write a short comment explaining your change (or "none" for internal only changes)
changelog: Fix the [
unwrap_used
] lint to also trigger for code of the form.get(i).unwrap()
and.get_mut(i).unwrap()
fixes #8124