Skip to content
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

Needless Question Mark Lint #6507

Merged
merged 1 commit into from
Jan 4, 2021
Merged

Conversation

bengsparks
Copy link
Contributor

@bengsparks bengsparks commented Dec 26, 2020

Fixes #6410, i.e the needless question mark lint

changelog: [needless_question_mark] New lint

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 26, 2020
@bengsparks
Copy link
Contributor Author

There are a number of matches in test code, most of which seems to be accurate.
However, in $DIR/try_err.rs:56:5, there is a snippet that triggers my lint.

let err: i8 = 1;
// To avoid warnings during rustfix
if true {
    Err(err)?;
}
Ok(i)

While the Err(err)? line is worthy of linting, it should not trigger this lint, correct? @flip1995

@bengsparks
Copy link
Contributor Author

Upon closer review, it appears that my lint did not trigger the aforementioned lines.

clippy_lints/src/needless_question_mark.rs Outdated Show resolved Hide resolved
clippy_lints/src/needless_question_mark.rs Outdated Show resolved Hide resolved
clippy_lints/src/needless_question_mark.rs Show resolved Hide resolved
clippy_lints/src/needless_question_mark.rs Outdated Show resolved Hide resolved
tests/ui/needless_question_mark.rs Show resolved Hide resolved
@bengsparks bengsparks requested a review from flip1995 December 29, 2020 13:40
Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

LGTM overall. After addressing the remaining 2 comments, please squash some of your commits (it doesn't have to be one commit, if you want to split it up a bit).

clippy_lints/src/lib.rs Outdated Show resolved Hide resolved
clippy_lints/src/needless_question_mark.rs Outdated Show resolved Hide resolved
Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

The examples in the documentation seem weird to me. Otherwise LGTM.

clippy_lints/src/needless_question_mark.rs Outdated Show resolved Hide resolved
@flip1995 flip1995 added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Jan 4, 2021
@bengsparks bengsparks force-pushed the lint/issue6410 branch 4 times, most recently from 2ee8533 to 85da53a Compare January 4, 2021 13:45
@flip1995
Copy link
Member

flip1995 commented Jan 4, 2021

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Jan 4, 2021

📌 Commit ba87acb has been approved by flip1995

@bors
Copy link
Contributor

bors commented Jan 4, 2021

⌛ Testing commit ba87acb with merge 7b727fa...

bors added a commit that referenced this pull request Jan 4, 2021
Needless Question Mark Lint

Fixes #6410, i.e the needless question mark lint
@bors
Copy link
Contributor

bors commented Jan 4, 2021

💔 Test failed - checks-action_test

@flip1995
Copy link
Member

flip1995 commented Jan 4, 2021

@bors retry

@bors
Copy link
Contributor

bors commented Jan 4, 2021

⌛ Testing commit ba87acb with merge ae9ae97...

@bors
Copy link
Contributor

bors commented Jan 4, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing ae9ae97 to master...

@bors bors merged commit ae9ae97 into rust-lang:master Jan 4, 2021
@bengsparks bengsparks deleted the lint/issue6410 branch January 4, 2021 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lint Suggestion: reimplementing .and_then with Some(x?)
5 participants