-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 #124621
Clippy subtree update #124621
Conversation
…t_macro_call` function in `clippy_utils`
…r false help messages if in one.
…ass_by_ref_mut, r=Manishearth Emit the `needless_pass_by_ref_mut` lint on `self` arguments as well Fixes rust-lang/rust-clippy#12589. Fixes rust-lang/rust-clippy#9591. The first commit fixes a bug I uncovered while working on this: sometimes, the mutable borrow "event" happens before the alias one, which makes some argument detected as not used mutably even if they are. The fix was simply to fill the map with the aliases afterwards. The second commit removes the restriction to not run `self` argument for the `needless_pass_by_ref_mut` lint. changelog: emit the `needless_pass_by_ref_mut` lint on `self` arguments as well r? `@Manishearth`
…hable initializers This commit introduces a check to ensure that the lint won't trigger when the initializer is unreachable, such as: ``` thread_local! { static STATE: Cell<usize> = panic!(); } ``` This is achieved by looking at the unpeeled initializer expression and ensuring that the parent macro is not `panic!()`, `todo!()`, `unreachable!()`, `unimplemented!()`. fixes rust-lang#12637 changelog: [`threadlocal_initializer_can_be_made_const`] will no longer trigger on `unreachable` macros.
Threadlocal_initializer_can_be_made_const will not trigger for unreachable initializers This commit introduces a check to ensure that the lint won't trigger when the initializer is unreachable, such as: ``` thread_local! { static STATE: Cell<usize> = panic!(); } ``` This is achieved by looking at the unpeeled initializer expression and ensuring that the parent macro is not `panic!()`, `todo!()`, `unreachable!()`, `unimplemented!()`. fixes rust-lang#12637 changelog: [`threadlocal_initializer_can_be_made_const`] will no longer trigger on `unreachable` macros.
…indirect, r=llogiq Rework interior mutability detection Replaces the existing interior mutability detection, the two main changes being - It now follows references/pointers e.g. `struct S(&Cell)` - `mutable_key_type` ignores pointers as it did before - The `ignore_interior_mutability` config now applies to types containing the ignored type, e.g. `http::HeaderName` Fixes rust-lang/rust-clippy#7752 Fixes rust-lang/rust-clippy#9776 Fixes rust-lang/rust-clippy#9801 changelog: [`mutable_key_type`], [`declare_interior_mutable_const`]: now considers types that have references to interior mutable types as interior mutable
…on, r=Alexendoo Fix `is_test_module_or_function` The rustdoc comment for `is_test_module_or_function` states: https://github.com/rust-lang/rust-clippy/blob/2795a6018944a5918b7d276267165484f5d62d6a/clippy_utils/src/lib.rs#L2561-L2566 Given `item`, the function calls `is_in_test_function` with `item.hir_id()`. However, `is_in_test_function` considers only `item`'s parents, not `item` itself. This PR fixes the problem. The `test_with_disallowed_name` test fails without the fix, but passes once applied. changelog: none
…nly, r=xFrednet reduce `single_char_pattern` to only lint on ascii chars This should mostly fix the `single_char_pattern` lint, because with a single byte, the optimizer will usually see through the char-to-string-expansion and single loop iteration. This fixes rust-lang#11675 and rust-lang#8111. Update: As per the meeting on November 28th, 2023, we voted to also downgrade the lint to pedantic. --- changelog: downgrade [`single_char_pattern`] to `pedantic`
[arithmetic_side_effects] Fix rust-lang#12318 Fix rust-lang#12318 changelog: [arithmetic_side_effects]: Consider method calls that correspond to arithmetic symbols
…s, r=jackh726 `has_typeck_results` doesnt need to be a query self-explanatory
…s, r=davidtwco Disallow ambiguous attributes on expressions This implements the suggestion in [rust-lang#15701](rust-lang#15701 (comment)) to disallow ambiguous outer attributes on expressions. This should resolve one of the concerns blocking the stabilization of `stmt_expr_attributes`.
Signed-off-by: forcedebug <[email protected]>
chore: fix some typos in comments *Please write a short comment explaining your change (or "none" for internal only changes)* changelog: none
…ict with `needless_return`
Both clippy_utils::paths::SLICE_GET and clippy_utils::paths::STR_BYTES are dead_code and can therefore be removed.
Co-authored-by: Timo <[email protected]>
Changelog for Clippy 1.78 🪄 Roses and Violets have colors, Red and Blue are the two, I'm getting to the end of my masters, what a cool goal to pursue --- ### The cat of this release is: *Shadow* submitted by `@benwh1:` <img height=500 src="https://github.com/rust-lang/rust-clippy/assets/32911992/c56af314-4644-482a-a08e-f32f4c7d7b22" alt="The cats of this Clippy release" /> Cats for the next release can be nominated in the comments :D --- changelog: none
Bump ui_test to 0.23 Notable changes: more control over run/rustfix/... and other rustc-specific features. All of these can in theory now be implemented entirely out of tree changelog: none
Rustup r? `@ghost` changelog: none
fix `for x in y unsafe { }` fixes rust-lang#12514 ---- changelog: [`needless_for_each`]: unsafe block in for loop body suggestion
Remove `dead_code` paths The following paths are `dead_code` and can be removed: ### `clippy_utils::paths::VEC_RESIZE` * Introduced when `vec_resize_to_zero` lint added in PR rust-lang/rust-clippy#5637 * No longer used after commit rust-lang/rust-clippy@8acc4d2 ### `clippy_utils::paths::SLICE_GET` * Introduced when `get_first` lint added in PR rust-lang/rust-clippy#8882 * No longer used after commit rust-lang/rust-clippy@a8d80d5 ### `clippy_utils::paths::STR_BYTES` * Introduced when `bytes_count_to_len` lint added in PR rust-lang/rust-clippy#8711 * No longer used after commit rust-lang/rust-clippy@ba6a459 When the lints were moved into the `Methods` lint pass, they switched from using paths to diagnostic items. However, the paths were never removed. This occurred in PR rust-lang/rust-clippy#8957. This relates to issue rust-lang/rust-clippy#5393 changelog: none
Suggest collapsing nested or patterns if the MSRV allows it Nested `or` patterns have been stable since 1.53, so we should be able to suggest `Some(1 | 2)` if the MSRV isn't set below that. This change adds an msrv check and also moves it to `matches/mod.rs`, because it's also needed by `redundant_guards`. changelog: [`collapsible_match`]: suggest collapsing nested or patterns if the MSRV allows it
Some changes occurred in src/tools/clippy cc @rust-lang/clippy These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
@bors r+ p=1 |
☀️ Test successful - checks-actions |
Finished benchmarking commit (a8773d5): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 674.97s -> 677.471s (0.37%) |
r? @Manishearth