-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Clippy subtree update #142451
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
Clippy subtree update #142451
Conversation
Looks for `TryFrom` implementations with uninhabited error types and suggests to implement `From` instead.
Keep the `P` constructor function for now, to minimize immediate churn. All the `into_inner` calls are removed, which is nice.
If an early return is found under the HIR local declaration node but before the child process is created, it should not trigger the lint because the child process has not yet been created.
Specifically `TyAlias`, `Enum`, `Struct`, `Union`. So the fields match the textual order in the source code. The interesting part of the change is in `compiler/rustc_hir/src/hir.rs`. The rest is extremely mechanical refactoring.
When determining when a function or method can be called from a `const` context, the determination must be made on the instance, not on the declaration. This makes a difference, for example, with `const_trait` traits whose implementations may or may not be `const`.
…atten, r=jhpratt Stabilize feature `result_flattening` Stabilizes the `Result::flatten` method ## Implementations - [x] Implementation `Result::flatten`: rust-lang#70140 - [x] Implementation `const` `Result::flatten`: rust-lang#130692 - [x] Update stabilization attribute macros (this PR) ## Stabilization process - [x] Created this PR [suggested](rust-lang#70142 (comment)) by ``@RalfJung`` - [x] FCP (haven't found any, is it applicable here?) - [ ] Close issue rust-lang#70142
I read a blog post about kernel security, and how various features might get lost while porting to Rust. In kernel C, they have some guardrails against divulging pointers. An easy way to replicate that in Rust is a lint for pointer formatting. So that's what this lint does. --- changelog: new [`pointer_format`] lint
In order to be consistent with our documentation, deprecated lints should not be counted when displaying the total number of lints on the [web site](https://rust-lang.github.io/rust-clippy/master/index.html). For example, as of 2025-06-01, there are 784 non-deprecated lints which are referred to as "over 750 lints" in the documentation, but the web site displays "Total number: 799". When one new lint will be added, there will be a discrepancy ("over 750 lints" vs. "Total number: 800") if this is not fixed.
In order to be consistent with our documentation, deprecated lints should not be counted when displaying the total number of lints on the [web site](https://rust-lang.github.io/rust-clippy/master/index.html). For example, as of 2025-06-01, there are 784 non-deprecated lints which are referred to as "over 750 lints" in the documentation, but the web site displays "Total number: 799". When one new lint will be added, there will be a discrepancy ("over 750 lints" vs. "Total number: 800") if this is not fixed. changelog: none r? @llogiq
rust-lang#14949) changelog: [update_lints]: replaced a smart quote
I find it much easier to think about in the positive sense.
…st-lang#14954) Closes rust-lang/rust-clippy#14926 changelog: [`semicolon_outside_block`] fix wrong suggestions when inside macros
`clippy_lints::casts::utils::int_ty_to_nbits` used to return `0` to indicate that the argument was not an integral type. It is more idiomatic to use `Option<u64>` as a return type.
Looks for `TryFrom` implementations with uninhabited error types and suggests to implement `From` instead. Fixes rust-lang/rust-clippy#2144 --- changelog: Add [`infallible_try_from`] lint
Closes rust-lang/rust-clippy#14857 changelog: [`unit_arg`] fix wrong suggestion for `Default::default`
Fixes: rust-lang/rust-clippy#14931 changelog: Fix [`manual_swap`]'s suggestion-causes-error when the variable is mutable or as loop variable.
So this is funny, the query `tcx.module_children` was top 3 in most time consuming functions in Clippy, it was being called 24384 times in tokio. "Unacceptable!" I thought. Digging a bit around, turns out that `clippy::strlen_on_c_strings` was calling for `get_def_path` via `match_libc_symbol`. This query pretty-prints things and performs some analysis. Yes, we were running early lint checks to see if symbols were from `libc`. I don't really trust callgrind when it says I've turn 81 billion instructions into like 10 million. So I benchmarked this the good ol' "compiling 20 times without incr" method and it went from 0.31s-0.45s to 0.25s constistently. (Profiled, and "benchmarked") on tokio.
So this is funny, the query `tcx.module_children` was top 3 in most time consuming functions in Clippy, it was being called 24384 times in tokio. "Unacceptable!" I thought. Digging a bit around, turns out that `clippy::strlen_on_c_strings` was calling for `get_def_path` via `match_libc_symbol`. This query pretty-prints things and performs some analysis. Yes, we were running early lint checks to see if symbols were from `libc`. I don't really trust callgrind when it says I've turn 81 billion instructions into like 10 million. So I benchmarked this the good ol' "compiling 20 times without incr" method and it went from 0.31s-0.45s to 0.25s constistently. (Profiled, and "benchmarked") on tokio. What I can get behind is via `strlen_on_c_strings` changing from 31 million instructions into 76k. 🎉 🥳 changelog: [`strlen_on_c_strings`]: Optimize it by 99.75%
r? @ghost changelog: none
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
|
This comment has been minimized.
This comment has been minimized.
We're running clippy on bootstrap now 👀 that's good news. Now I have to figure out how to do that locally. |
maybe |
That's a FP: rust-lang/rust-clippy#15045 I moved the lint to nursery, as I think this is significant and a lot of people will encounter this. |
Thanks! That's it. As I have |
@bors r+ p=2 rollup=never |
☀️ Test successful - checks-actions |
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 c359117 (parent) -> 0d6ab20 (this PR) Test differencesNo test diffs found Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 0d6ab209c525e276cbe7544cbd39a3c3619b6b18 --output-dir test-dashboard And 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 (0d6ab20): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 755.253s -> 755.964s (0.09%) |
r? @Manishearth
1 day late. Got distracted yesterday evening and forgot about it.