-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Update Clippy #90126
Update Clippy #90126
Conversation
make test module detection more strict I started with some small improvements to clippy_utils/src/lib.rs, but then found that our "test" module detection would also catch words containing "test" like e.g. "attestation". So I made this a bit more strict (splitting by `'_'` and checking for `test` or `tests`), adding a test case as I went. --- *Please write a short comment explaining your change (or "none" for internal only changes)* changelog: none
Make `shadow_reuse` suggestion less verbose Closes rust-lang#7764 Make `shadow_reuse` suggestion less verbose. changelog: [`shadow_reuse`] does not warn shadowing statement
…r=camsteffen Restriction lint for function pointer casts The existing lints for function pointer casts cover the cases where a cast is non-portable or would result in truncation, however there's currently no way to forbid numeric function pointer casts entirely. I've added a new lint `fn_to_numeric_cast_any`, which allows one to ban _all_ numeric function pointer casts, including to `usize`. This is useful if you're writing high-level Rust and want to opt-out of potentially surprising behaviour, avoiding silent bugs from forgotten parentheses, e.g. ```rust fn foo() -> u32 { 10 } fn main() { let _ = foo as usize; // oops, forgot to call foo and got a random address instead! } ``` ~~I'm open to suggestions for the naming of the lint, because `fn_to_numeric_cast_any` is a bit clunky. Ideally I'd call this lint `fn_to_numeric_cast`, but that name is already taken for the more specific lint~~. We've stuck with `fn_to_numeric_cast_any` to avoid renaming the existing lint, or choosing a different name that's too generic (like `fn_cast`). I'm also open to changing the suggestion behaviour, as adding parentheses is only one of many possible ways to fix the lint. changelog: add ``[`fn_to_numeric_cast_any`]`` restriction lint
…=flip1995 Add undocumented_unsafe_blocks lint changelog: Added a new lint [`undocumented_unsafe_blocks`] Fixes rust-lang#7464, rust-lang#7238 (?)
Before this lint didn't trigger on macros. With rust-lang#88175 this isn't enough anymore. In this PR a `WhileLoop` desugaring kind was introduced. This overrides the span of expanded expressions when lowering the while loop. So if a while loop is in a macro, the expressions that it expands to are no longer marked with `ExpnKind::Macro`, but with `ExpnKind::Desugaring`. In general, this is the correct behavior and the same that is done for `ForLoop`s. It just tripped up this lint.
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
…ed, r=camsteffen Don't trigger semicolon_if_nothing_returned in expanded code Fixes rust-lang#7768 Before, this lint didn't trigger on macros. With rust-lang#88175 this isn't enough anymore. In this PR a `WhileLoop` desugaring kind was introduced. This overrides the span of expanded expressions when lowering the while loop. So if a while loop is in a macro, the expressions that it expands to are no longer marked with `ExpnKind::Macro`, but with `ExpnKind::Desugaring`. In general, this is the correct behavior and the same that is done for `ForLoop`s. It just tripped up this lint. r? `@camsteffen` changelog: [`semicolon_if_nothing_returned`]: Fix regression on macros containing while loops
Fix false positive when `Drop` and `Copy` involved in `field_reassign_with_default` lint Fix FP in `field_reassign_with_default` lint when type implements `Drop` but not all fields are `Copy`. fixes: rust-lang#6312 changelog: [`field_reassign_with_default`] Fix FP when `Drop` and `Copy` are involved
Rustup r? `@ghost` changelog: none
Some changes occurred in src/tools/clippy. cc @rust-lang/clippy |
@bors r+ p=1 |
📌 Commit 8d5f69d has been approved by |
⌛ Testing commit 8d5f69d with merge afe6f3ab0c3be6711694464eaee806391786f062... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
That seems spurious. @bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (68a698b): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
This seems to cause rust-lang/rust-clippy#7859, is the next clippy update with the fix in it already on its way? |
Yes, the next sync will include the fix. 2021-11-04 If this is important, we can do an out-of-cycle sync though. |
Probably not important enough. I've silenced the lint where it triggered wrongly. |
r? @Manishearth
This adds a new dep to Clippy: indoc
And transitively: unindent