Clippy subtree update#158403
Conversation
…t suggestion When suggesting `sort_by_key` for a reversed comparator like `|a, b| b.foo.cmp(&a.foo)`, the lint was picking `left_expr` (the receiver of `.cmp()`, which references `b`) and `r_pat` as the closure arg, producing `|b| Reverse(b.foo)`. Both sides consistently named `b`, but `b` is the second parameter — confusing and inconsistent with the forward-sort suggestion style. Fix by using `right_expr` (the `.cmp()` argument, which references `a`) as the key body and `l_pat` as the closure parameter, peeling the single `&` that `.cmp(&rhs)` introduces so the suggestion doesn't contain a spurious borrow.
The choice of `std::env::current_dir` made me originally think this was about file and directory paths - use an item where "path" couldn't mean something else. `std::f64::consts::PI` was chosen to match the example.
This lint suggests using `as_chunks` or `as_chunks_mut` instead of `chunks_exact` or `chunks_exact_mut` when called with a constant size. changelog: new lint: [`chunks_exact_to_as_chunks`]
update test comments
An explicit type annotation on the LHS (`let _: T = expr`) signals an intentional discard, mirroring the rationale for `let_underscore_untyped`. Without this gate, typed bindings such as `let _: Pin<Box<dyn Future<Output = ()>>> = foo();` trigger the lint despite the author explicitly opting in. changelog: [`let_underscore_future`]: no longer triggers when the binding has an explicit type annotation Signed-off-by: ChrisJr404 <chris@hacknow.com>
…y_kind_from_def_id and new_from_def_id
…BoxyUwU remove `IsTypeConst` from `hir::TraitItemKind` Fixes rust-lang#152940 following up on rust-lang#152940 (comment) r? @BoxyUwU
*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/17042)* changelog: [`by_ref_peekable_peek`]: new lint Closes rust-lang/rust-clippy#17020
Instead of bailing, this changes the lint to handle the return type and write out the correct result. If the function we're translating into can handle it, we use a turbofish, since that will influence type inference but not cause integer truncation. But, if that can't be done, it'll use `as` and let a future lint take care of that.
| crate | instructions base | instructions new | delta | |---|---|---|---| | cargo-0.80.0 (lib) | 29,893,214,650 | 29,726,591,660 | -0.56% | | cargo-0.80.0 (bin) | 1,631,825,989 | 1,627,901,224 | -0.24% | | serde-1.0.204 | 7,203,901,010 | 7,167,022,578 | -0.51% | | tokio-1.38.1 | 522,611,594 | 518,512,971 | -0.78% | | ryu-1.0.18 | 271,073,171 | 270,569,049 | -0.19% | changelog: none
- make the comments more specific and useful - add return-type ascription even if there are params that still prevent this from being a machine applicable lint
…s allowed (rust-lang#17217) Instruction counts (perf stat instructions:u): | crate | instructions base | instructions new | delta | |---|---|---|---| | regex-1.10.5 | 1,010,565,235 | 968,595,926 | -4.15% | | bumpalo-3.16.0 | 320,518,375 | 313,577,464 | -2.17% | | tokio-1.38.1 | 522,405,496 | 510,949,744 | -2.19% | | mdbook-0.4.40 (bin) | 3,475,263,547 | 3,466,707,439 | -0.25% | | ripgrep-14.1.0 | 1,969,387,093 | 1,957,903,931 | -0.58% | changelog: none
|
|
I guess this was already an issue before, but could you please add a debug_assert to make sure the remainder is empty? |
|
@bors r+ p=2 rollup=never |
|
@bors r- r=me after the suggestion is implemented |
|
This pull request was unapproved. |
Sure, can do. But that is already guaranteed by the |
Yes please. |
6c335ef to
91c04df
Compare
|
I amended it to 91c04df, PTAL. |
|
@bors r+ p=2 |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 40557f6 (parent) -> eb6346c (this PR) Test differencesShow 3 test diffsStage 2
Additionally, 2 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard eb6346c659ccb0468a1477c716ca5450a1fa9ba1 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (eb6346c): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (secondary 2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.8%, secondary -5.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 482.935s -> 485.381s (0.51%) |
View all comments
r? Manishearth