Skip to content

Fix as_deref_mut false positives in needless_option_as_deref #8646

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

Merged
merged 1 commit into from
Apr 7, 2022

Conversation

Alexendoo
Copy link
Member

Also moves it into methods/

Fixes #7846
Fixes #8047

changelog: [needless_option_as_deref]: No longer lints for as_deref_mut on Options that cannot be moved

supersedes #8064

@rust-highfive
Copy link

r? @giraffate

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 6, 2022
@bors
Copy link
Contributor

bors commented Apr 6, 2022

☔ The latest upstream changes (presumably #8606) made this pull request unmergeable. Please resolve the merge conflicts.

@Alexendoo Alexendoo force-pushed the option-as-deref-mut branch from 4f36767 to 868072f Compare April 6, 2022 19:44
@@ -2106,6 +2107,30 @@ declare_clippy_lint! {
"using `.collect::<Vec<String>>().join(\"\")` on an iterator"
}

declare_clippy_lint! {
/// ### What it does
/// Checks for no-op uses of Option::{as_deref,as_deref_mut},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits

Suggested change
/// Checks for no-op uses of Option::{as_deref,as_deref_mut},
/// Checks for no-op uses of `Option::{as_deref,as_deref_mut}`,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Changed

Also moves the lint to the methods directory
@Alexendoo Alexendoo force-pushed the option-as-deref-mut branch from 868072f to 182b7c3 Compare April 7, 2022 11:39
@giraffate
Copy link
Contributor

@bors r+

It looks good, thanks!

@bors
Copy link
Contributor

bors commented Apr 7, 2022

📌 Commit 182b7c3 has been approved by giraffate

@bors
Copy link
Contributor

bors commented Apr 7, 2022

⌛ Testing commit 182b7c3 with merge 650a0e5...

@bors
Copy link
Contributor

bors commented Apr 7, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: giraffate
Pushing 650a0e5 to master...

@bors bors merged commit 650a0e5 into rust-lang:master Apr 7, 2022
@Alexendoo Alexendoo deleted the option-as-deref-mut branch April 7, 2022 13:34
bors added a commit that referenced this pull request Apr 14, 2022
Check for loops/closures in `local_used_after_expr`

Follow up to #8646, catches when a local is used multiple times because it's in a loop or a closure

changelog: none
github-merge-queue bot pushed a commit that referenced this pull request Feb 17, 2025
fixes #14148

Another case of #13077 and #8646

changelog: [`needless_option_as_deref`]: fix FP in trait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
4 participants