-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
more clippy cleanups #69713
Merged
Merged
more clippy cleanups #69713
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
matthiaskrgr
commented
Mar 4, 2020
- Don't use .ok() before unwrapping via .expect() on a Result.
- Use .map() to modify data inside Options instead of using .and_then(|x| Some(y))
- Use .as_deref() instead of .as_ref().map(Deref::deref)
- Don't use "if let" bindings to only check a value and not actually bind anything.
- Use single-char patter on {ends,starts}_with and remove clone on copy type.
The Result can be expect-unwrapped directly. (clippy::ok_expect)
…x| Some(y)) (clippy::option_and_then_some)
…nd anything. For example: `if let Some(_) = foo() {}` can be reduced to `if foo().is_some() {}` (clippy::redundant_pattern_matching)
… type. These were introduced since I last fixed most of these occurences. (clippy::clone_on_copy, clippy::single_char_pattern)
@bors r+ rollup |
📌 Commit 80ed505 has been approved by |
bors
added
the
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
label
Mar 4, 2020
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this pull request
Mar 4, 2020
more clippy cleanups * Don't use .ok() before unwrapping via .expect() on a Result. * Use .map() to modify data inside Options instead of using .and_then(|x| Some(y)) * Use .as_deref() instead of .as_ref().map(Deref::deref) * Don't use "if let" bindings to only check a value and not actually bind anything. * Use single-char patter on {ends,starts}_with and remove clone on copy type.
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Mar 5, 2020
more clippy cleanups * Don't use .ok() before unwrapping via .expect() on a Result. * Use .map() to modify data inside Options instead of using .and_then(|x| Some(y)) * Use .as_deref() instead of .as_ref().map(Deref::deref) * Don't use "if let" bindings to only check a value and not actually bind anything. * Use single-char patter on {ends,starts}_with and remove clone on copy type.
bors
added a commit
that referenced
this pull request
Mar 5, 2020
Rollup of 10 pull requests Successful merges: - #69520 (Make error message clearer about creating new module) - #69589 (ast: `Mac`/`Macro` -> `MacCall`) - #69614 (`delay_span_bug` when codegen cannot select obligation) - #69641 (Update books) - #69674 (Rename DefKind::Method and TraitItemKind::Method ) - #69697 (Add explanation for E0380) - #69698 (Use associated constants of integer types) - #69705 (Toolstate: remove redundant beta-week check.) - #69711 (Update macros.rs: fix documentation typo.) - #69713 (more clippy cleanups) Failed merges: r? @ghost
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Mar 5, 2020
more clippy cleanups * Don't use .ok() before unwrapping via .expect() on a Result. * Use .map() to modify data inside Options instead of using .and_then(|x| Some(y)) * Use .as_deref() instead of .as_ref().map(Deref::deref) * Don't use "if let" bindings to only check a value and not actually bind anything. * Use single-char patter on {ends,starts}_with and remove clone on copy type.
bors
added a commit
that referenced
this pull request
Mar 5, 2020
Rollup of 8 pull requests Successful merges: - #69697 (Add explanation for E0380) - #69698 (Use associated constants of integer types) - #69711 (Update macros.rs: fix documentation typo.) - #69713 (more clippy cleanups) - #69728 (Make link to `std::str` active) - #69732 (Clean E0382 and E0384 explanations) - #69736 (even more clippy cleanups) - #69742 (Fixed a typo) Failed merges: r? @ghost
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.