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

more clippy cleanups #69713

Merged
merged 5 commits into from
Mar 6, 2020
Merged

more clippy cleanups #69713

merged 5 commits into from
Mar 6, 2020

Conversation

matthiaskrgr
Copy link
Member

  • 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)
…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)
@cramertj
Copy link
Member

cramertj commented Mar 4, 2020

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 4, 2020

📌 Commit 80ed505 has been approved by cramertj

@bors 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
@bors bors merged commit 22a743b into rust-lang:master Mar 6, 2020
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants