Skip to content

even more clippy cleanups #69736

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 7 commits into from
Mar 6, 2020
Merged

Conversation

matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr commented Mar 5, 2020

  • Don't pass &mut where immutable reference (&) is sufficient (clippy::unnecessary_mut_passed)
  • Use more efficient &&str to String conversion (clippy::inefficient_to_string)
  • Don't always eval arguments inside .expect(), use unwrap_or_else and closure. (clippy::expect_fun_call)
  • Use righthand '&' instead of lefthand "ref". (clippy::toplevel_ref_arg)
  • Use simple 'for i in x' loops instead of 'while let Some(i) = x.next()' loops on iterators. (clippy::while_let_on_iterator)
  • Const items have by default a static lifetime, there's no need to annotate it. (clippy::redundant_static_lifetimes)
  • Remove redundant patterns when matching ( x @ _ to x) (clippy::redundant_pattern)

@ghost
Copy link

ghost commented Mar 5, 2020

Was it in consideration to force clippy warnings to be resolve before a merge?
Or maybe notify about the amount/list of newly introduced issues?

@matthiaskrgr
Copy link
Member Author

There are too many false positives imo.

// not advance `caller_iter` for ZSTs.
let mut locals_iter = body.args_iter();
while let Some(local) = locals_iter.next() {
// not advance `caller_iter` for ZSTs
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// not advance `caller_iter` for ZSTs
// not advance `caller_iter` for ZSTs.

@Dylan-DPC-zz
Copy link

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Mar 5, 2020

📌 Commit 84577c8 has been approved by Dylan-DPC

@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 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 67d735c into rust-lang:master Mar 6, 2020
@matthiaskrgr matthiaskrgr deleted the even_more_clippy branch January 25, 2025 09:12
# for free to join this conversation on GitHub. Already have an account? # 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.

5 participants