]> git.lizzy.rs Git - rust.git/commit
Moar linting: needless_borrow, let_unit_value, ...
authorYuri Astrakhan <YuriAstrakhan@gmail.com>
Sat, 24 Dec 2022 21:09:08 +0000 (16:09 -0500)
committerYuri Astrakhan <YuriAstrakhan@gmail.com>
Sun, 25 Dec 2022 10:07:47 +0000 (05:07 -0500)
commitd3dbf9c194d0badc7c340ae012069f67d55e4753
tree9f1663fa2108a76e552c5d42dcf91e6a88099aef
parent2872e0558982360d499bdba79cf1a3ed06f1ae82
Moar linting: needless_borrow, let_unit_value, ...

* 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)`
15 files changed:
crates/flycheck/src/lib.rs
crates/parser/src/grammar.rs
crates/parser/src/shortcuts.rs
crates/parser/src/tests.rs
crates/proc-macro-api/src/process.rs
crates/proc-macro-test/build.rs
crates/syntax/src/ast/prec.rs
crates/syntax/src/ptr.rs
crates/syntax/src/validation.rs
crates/test-utils/src/bench_fixture.rs
crates/test-utils/src/lib.rs
crates/toolchain/src/lib.rs
xtask/src/install.rs
xtask/src/release.rs
xtask/src/release/changelog.rs