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

Moar linting: needless_borrow, let_unit_value, ... #13841

Merged
merged 1 commit into from
Dec 27, 2022

Conversation

nyurik
Copy link
Contributor

@nyurik nyurik commented Dec 24, 2022

  • There are a few needless borrows that don't seem to be needed. I even did a quick assembly comparison and posted a q to stackoveflow on it. See here
  • removed several let _ = ... when they don't look necessary (even a few ones that were not suggested by clippy (?))
  • some unneeded assignment+return - keep the code a bit leaner
  • a few writeln! instead of write!, or even consolidate write!
  • a nice optimization to use ch.is_ascii_digit instead of ch.is_digit(10)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 24, 2022
@nyurik nyurik force-pushed the lints2 branch 2 times, most recently from 4a9d2a4 to 527f86d Compare December 24, 2022 23:31
@bors
Copy link
Collaborator

bors commented Dec 25, 2022

☔ The latest upstream changes (presumably #13835) made this pull request unmergeable. Please resolve the merge conflicts.

* There are a few needless borrows that don't seem to be needed. I even did a quick assembly comparison and posted a q to stackoveflow on it. See [here](https://stackoverflow.com/questions/74910196/advantages-of-pass-by-ref-val-with-impl-intoiteratoritem-impl-asrefstr)
* removed several `let _ = ...` when they don't look necessary (even a few ones that were not suggested by clippy (?))
* there were a few `then(|| ctor{})` that clippy suggested to replace with `then_some(ctor{})` -- seems reasonable?
* some unneeded assignment+return - keep the code a bit leaner
* a few `writeln!` instead of `write!`, or even consolidate write!
* a nice optimization to use `ch.is_ascii_digit` instead of `ch.is_digit(10)`
@lnicola
Copy link
Member

lnicola commented Dec 27, 2022

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 27, 2022

📌 Commit d3dbf9c has been approved by lnicola

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Dec 27, 2022

⌛ Testing commit d3dbf9c with merge 3033c3d...

@bors
Copy link
Collaborator

bors commented Dec 27, 2022

☀️ Test successful - checks-actions
Approved by: lnicola
Pushing 3033c3d to master...

@bors bors merged commit 3033c3d into rust-lang:master Dec 27, 2022
@nyurik nyurik deleted the lints2 branch January 10, 2023 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants