Skip to content

more clippy cleanups - #69713

Merged
bors merged 5 commits into
rust-lang:masterfrom
matthiaskrgr:more_cleanup
Mar 6, 2020
Merged

more clippy cleanups#69713
bors merged 5 commits into
rust-lang:masterfrom
matthiaskrgr:more_cleanup

Conversation

@matthiaskrgr

Copy link
Copy Markdown
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
Copy Markdown
Member

@bors r+ rollup

@bors

bors commented Mar 4, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 80ed505 has been approved by cramertj

@borsbors 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.
@JohnTitorJohnTitor mentioned this pull request Mar 5, 2020
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.
@JohnTitorJohnTitor mentioned this pull request Mar 5, 2020
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:masterMar 6, 2020
@matthiaskrgr
matthiaskrgr deleted the more_cleanup branch January 25, 2025 09:12
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: 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

@matthiaskrgr@cramertj@bors