Skip to content

Commit bdaba05

Browse files
committed
Auto merge of #143064 - flip1995:clippy-subtree-update, r=GuillaumeGomez
Clippy subtree update r? `@Manishearth` Cargo.lock update due to version bump
2 parents fe5f3de + d9a4fd5 commit bdaba05

File tree

157 files changed

+3174
-850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+3174
-850
lines changed

Cargo.lock

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
537537

538538
[[package]]
539539
name = "clippy"
540-
version = "0.1.89"
540+
version = "0.1.90"
541541
dependencies = [
542542
"anstream",
543543
"askama",
@@ -547,6 +547,7 @@ dependencies = [
547547
"clippy_lints_internal",
548548
"clippy_utils",
549549
"color-print",
550+
"declare_clippy_lint",
550551
"filetime",
551552
"futures",
552553
"if_chain",
@@ -569,7 +570,7 @@ dependencies = [
569570

570571
[[package]]
571572
name = "clippy_config"
572-
version = "0.1.89"
573+
version = "0.1.90"
573574
dependencies = [
574575
"clippy_utils",
575576
"itertools",
@@ -592,12 +593,13 @@ dependencies = [
592593

593594
[[package]]
594595
name = "clippy_lints"
595-
version = "0.1.89"
596+
version = "0.1.90"
596597
dependencies = [
597598
"arrayvec",
598599
"cargo_metadata 0.18.1",
599600
"clippy_config",
600601
"clippy_utils",
602+
"declare_clippy_lint",
601603
"itertools",
602604
"quine-mc_cluskey",
603605
"regex-syntax 0.8.5",
@@ -622,7 +624,7 @@ dependencies = [
622624

623625
[[package]]
624626
name = "clippy_utils"
625-
version = "0.1.89"
627+
version = "0.1.90"
626628
dependencies = [
627629
"arrayvec",
628630
"itertools",
@@ -931,6 +933,10 @@ dependencies = [
931933
"winapi",
932934
]
933935

936+
[[package]]
937+
name = "declare_clippy_lint"
938+
version = "0.1.90"
939+
934940
[[package]]
935941
name = "derive-where"
936942
version = "1.4.0"

compiler/rustc_codegen_gcc/src/intrinsic/simd.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
6161
let (len, _) = args[1].layout.ty.simd_size_and_type(bx.tcx());
6262

6363
let expected_int_bits = (len.max(8) - 1).next_power_of_two();
64-
let expected_bytes = len / 8 + ((len % 8 > 0) as u64);
64+
let expected_bytes = len / 8 + ((!len.is_multiple_of(8)) as u64);
6565

6666
let mask_ty = args[0].layout.ty;
6767
let mut mask = match *mask_ty.kind() {
@@ -676,7 +676,8 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
676676
let elem_type = vector_type.get_element_type();
677677

678678
let expected_int_bits = in_len.max(8);
679-
let expected_bytes = expected_int_bits / 8 + ((expected_int_bits % 8 > 0) as u64);
679+
let expected_bytes =
680+
expected_int_bits / 8 + ((!expected_int_bits.is_multiple_of(8)) as u64);
680681

681682
// FIXME(antoyo): that's not going to work for masks bigger than 128 bits.
682683
let result_type = bx.type_ix(expected_int_bits);

src/bootstrap/src/utils/render_tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ impl<'a> Renderer<'a> {
202202
}
203203

204204
fn render_test_outcome_terse(&mut self, outcome: Outcome<'_>, test: &TestOutcome) {
205-
if self.terse_tests_in_line != 0 && self.terse_tests_in_line % TERSE_TESTS_PER_LINE == 0 {
205+
if self.terse_tests_in_line != 0
206+
&& self.terse_tests_in_line.is_multiple_of(TERSE_TESTS_PER_LINE)
207+
{
206208
if let Some(total) = self.tests_count {
207209
let total = total.to_string();
208210
let executed = format!("{:>width$}", self.executed_tests - 1, width = total.len());

src/tools/clippy/.github/ISSUE_TEMPLATE/new_lint.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: New lint suggestion
2-
description: Suggest a new Clippy lint.
2+
description: |
3+
Suggest a new Clippy lint (currently not accepting new lints)
4+
Check out the Clippy book for more information about the feature freeze.
35
labels: ["A-lint"]
46
body:
57
- type: markdown

src/tools/clippy/.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ order to get feedback.
3232

3333
Delete this line and everything above before opening your PR.
3434

35+
Note that we are currently not taking in new PRs that add new lints. We are in a
36+
feature freeze. Check out the book for more information. If you open a
37+
feature-adding pull request, its review will be delayed.
38+
3539
---
3640

3741
*Please write a short comment explaining your change (or "none" for internal only changes)*
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Feature freeze check
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'clippy_lints/src/declared_lints.rs'
7+
8+
jobs:
9+
auto-comment:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check PR Changes
14+
id: pr-changes
15+
run: echo "::set-output name=changes::${{ toJson(github.event.pull_request.changed_files) }}"
16+
17+
- name: Create Comment
18+
if: steps.pr-changes.outputs.changes != '[]'
19+
run: |
20+
# Use GitHub API to create a comment on the PR
21+
PR_NUMBER=${{ github.event.pull_request.number }}
22+
COMMENT="**Seems that you are trying to add a new lint!**\nWe are currently in a [feature freeze](https://doc.rust-lang.org/nightly/clippy/development/feature_freeze.html), so we are delaying all lint-adding PRs to August 1st and focusing on bugfixes.\nThanks a lot for your contribution, and sorry for the inconvenience.\nWith ❤ from the Clippy team"
23+
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
24+
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
25+
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"

src/tools/clippy/CHANGELOG.md

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,94 @@ document.
66

77
## Unreleased / Beta / In Rust Nightly
88

9-
[1e5237f4...master](https://github.com/rust-lang/rust-clippy/compare/1e5237f4...master)
9+
[03a5b6b9...master](https://github.com/rust-lang/rust-clippy/compare/03a5b6b9...master)
10+
11+
## Rust 1.88
12+
13+
Current stable, released 2025-06-26
14+
15+
[View all 126 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2025-03-21T10%3A30%3A57Z..2025-05-01T08%3A03%3A26Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
* Added [`swap_with_temporary`] to `complexity` [#14046](https://github.com/rust-lang/rust-clippy/pull/14046)
20+
* Added [`redundant_test_prefix`] to `restriction` [#13710](https://github.com/rust-lang/rust-clippy/pull/13710)
21+
* Added [`manual_dangling_ptr`] to `style` [#14107](https://github.com/rust-lang/rust-clippy/pull/14107)
22+
* Added [`char_indices_as_byte_indices`] to `correctness` [#13435](https://github.com/rust-lang/rust-clippy/pull/13435)
23+
* Added [`manual_abs_diff`] to `complexity` [#14482](https://github.com/rust-lang/rust-clippy/pull/14482)
24+
* Added [`ignore_without_reason`] to `pedantic` [#13931](https://github.com/rust-lang/rust-clippy/pull/13931)
25+
26+
### Moves and Deprecations
27+
28+
* Moved [`uninlined_format_args`] to `style` (from `pedantic`)
29+
[#14160](https://github.com/rust-lang/rust-clippy/pull/14160)
30+
* [`match_on_vec_items`] deprecated in favor of [`indexing_slicing`]
31+
[#14217](https://github.com/rust-lang/rust-clippy/pull/14217)
32+
* Removed superseded lints: `transmute_float_to_int`, `transmute_int_to_char`,
33+
`transmute_int_to_float`, `transmute_num_to_bytes` (now in rustc)
34+
[#14703](https://github.com/rust-lang/rust-clippy/pull/14703)
35+
36+
### Enhancements
37+
38+
* Configuration renamed from `lint-inconsistent-struct-field-initializers`
39+
to `check-inconsistent-struct-field-initializers`
40+
[#14280](https://github.com/rust-lang/rust-clippy/pull/14280)
41+
* Paths in `disallowed_*` configurations are now validated
42+
[#14397](https://github.com/rust-lang/rust-clippy/pull/14397)
43+
* [`borrow_as_ptr`] now lints implicit casts as well
44+
[#14408](https://github.com/rust-lang/rust-clippy/pull/14408)
45+
* [`iter_kv_map`] now recognizes references on maps
46+
[#14596](https://github.com/rust-lang/rust-clippy/pull/14596)
47+
* [`empty_enum_variants_with_brackets`] no longer lints reachable enums or enums used
48+
as functions within same crate [#12971](https://github.com/rust-lang/rust-clippy/pull/12971)
49+
* [`needless_lifetimes`] now checks for lifetime uses in closures
50+
[#14608](https://github.com/rust-lang/rust-clippy/pull/14608)
51+
* [`wildcard_imports`] now lints on `pub use` when `warn_on_all_wildcard_imports` is enabled
52+
[#14182](https://github.com/rust-lang/rust-clippy/pull/14182)
53+
* [`collapsible_if`] now recognizes the `let_chains` feature
54+
[#14481](https://github.com/rust-lang/rust-clippy/pull/14481)
55+
* [`match_single_binding`] now allows macros in scrutinee and patterns
56+
[#14635](https://github.com/rust-lang/rust-clippy/pull/14635)
57+
* [`needless_borrow`] does not contradict the compiler's
58+
`dangerous_implicit_autorefs` lint even though the references
59+
are not mandatory
60+
[#14810](https://github.com/rust-lang/rust-clippy/pull/14810)
61+
62+
### False Positive Fixes
63+
64+
* [`double_ended_iterator_last`] and [`needless_collect`] fixed FP when iter has side effects
65+
[#14490](https://github.com/rust-lang/rust-clippy/pull/14490)
66+
* [`mut_from_ref`] fixed FP where lifetimes nested in types were not considered
67+
[#14471](https://github.com/rust-lang/rust-clippy/pull/14471)
68+
* [`redundant_clone`] fixed FP in overlapping lifetime
69+
[#14237](https://github.com/rust-lang/rust-clippy/pull/14237)
70+
* [`map_entry`] fixed FP where lint would trigger without insert calls present
71+
[#14568](https://github.com/rust-lang/rust-clippy/pull/14568)
72+
* [`iter_cloned_collect`] fixed FP with custom `From`/`IntoIterator` impl
73+
[#14473](https://github.com/rust-lang/rust-clippy/pull/14473)
74+
* [`shadow_unrelated`] fixed FP in destructuring assignments
75+
[#14381](https://github.com/rust-lang/rust-clippy/pull/14381)
76+
* [`redundant_clone`] fixed FP on enum cast
77+
[#14395](https://github.com/rust-lang/rust-clippy/pull/14395)
78+
* [`collapsible_if`] fixed FP on block stmt before expr
79+
[#14730](https://github.com/rust-lang/rust-clippy/pull/14730)
80+
81+
### ICE Fixes
82+
83+
* [`missing_const_for_fn`] fix ICE with `-Z validate-mir` compilation option
84+
[#14776](https://github.com/rust-lang/rust-clippy/pull/14776)
85+
86+
### Documentation Improvements
87+
88+
* [`missing_asserts_for_indexing`] improved documentation and examples
89+
[#14108](https://github.com/rust-lang/rust-clippy/pull/14108)
90+
91+
### Others
92+
93+
* We're testing with edition 2024 now
94+
[#14602](https://github.com/rust-lang/rust-clippy/pull/14602)
95+
* Don't warn about unloaded crates in `clippy.toml` disallowed paths
96+
[#14733](https://github.com/rust-lang/rust-clippy/pull/14733)
1097

1198
## Rust 1.87
1299

@@ -5729,6 +5816,7 @@ Released 2018-09-13
57295816
[`disallowed_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_type
57305817
[`disallowed_types`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types
57315818
[`diverging_sub_expression`]: https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression
5819+
[`doc_broken_link`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_broken_link
57325820
[`doc_comment_double_space_linebreaks`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_comment_double_space_linebreaks
57335821
[`doc_include_without_cfg`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_include_without_cfg
57345822
[`doc_lazy_continuation`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
@@ -5967,6 +6055,7 @@ Released 2018-09-13
59676055
[`manual_is_ascii_check`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_ascii_check
59686056
[`manual_is_finite`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_finite
59696057
[`manual_is_infinite`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_infinite
6058+
[`manual_is_multiple_of`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of
59706059
[`manual_is_power_of_two`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_power_of_two
59716060
[`manual_is_variant_and`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_variant_and
59726061
[`manual_let_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

src/tools/clippy/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.89"
3+
version = "0.1.90"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"
@@ -24,6 +24,7 @@ path = "src/driver.rs"
2424
clippy_config = { path = "clippy_config" }
2525
clippy_lints = { path = "clippy_lints" }
2626
clippy_utils = { path = "clippy_utils" }
27+
declare_clippy_lint = { path = "declare_clippy_lint" }
2728
rustc_tools_util = { path = "rustc_tools_util", version = "0.4.2" }
2829
clippy_lints_internal = { path = "clippy_lints_internal", optional = true }
2930
tempfile = { version = "3.20", optional = true }

src/tools/clippy/book/src/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Clippy
22

3+
[### IMPORTANT NOTE FOR CONTRIBUTORS ================](development/feature_freeze.md)
4+
5+
----
6+
37
[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](https://github.com/rust-lang/rust-clippy#license)
48

59
A collection of lints to catch common mistakes and improve your

src/tools/clippy/book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [GitLab CI](continuous_integration/gitlab.md)
1414
- [Travis CI](continuous_integration/travis.md)
1515
- [Development](development/README.md)
16+
- [IMPORTANT: FEATURE FREEZE](development/feature_freeze.md)
1617
- [Basics](development/basics.md)
1718
- [Adding Lints](development/adding_lints.md)
1819
- [Defining Lints](development/defining_lints.md)

src/tools/clippy/book/src/development/adding_lints.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Adding a new lint
22

3+
[### IMPORTANT NOTE FOR CONTRIBUTORS ================](feature_freeze.md)
4+
5+
36
You are probably here because you want to add a new lint to Clippy. If this is
47
the first time you're contributing to Clippy, this document guides you through
58
creating an example lint from scratch.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# IMPORTANT: FEATURE FREEZE
2+
3+
This is a temporary notice.
4+
5+
From the 26th of June until the 18th of September we will perform a feature freeze. Only bugfix PRs will be reviewed
6+
except already open ones. Every feature-adding PR opened in between those dates will be moved into a
7+
milestone to be reviewed separately at another time.
8+
9+
We do this because of the long backlog of bugs that need to be addressed
10+
in order to continue being the state-of-the-art linter that Clippy has become known for being.
11+
12+
## For contributors
13+
14+
If you are a contributor or are planning to become one, **please do not open a lint-adding PR**, we have lots of open
15+
bugs of all levels of difficulty that you can address instead!
16+
17+
We currently have about 800 lints, each one posing a maintainability challenge that needs to account to every possible
18+
use case of the whole ecosystem. Bugs are natural in every software, but the Clippy team considers that Clippy needs a
19+
refinement period.
20+
21+
If you open a PR at this time, we will not review it but push it into a milestone until the refinement period ends,
22+
adding additional load into our reviewing schedules.
23+
24+
## I want to help, what can I do
25+
26+
Thanks a lot to everyone who wants to help Clippy become better software in this feature freeze period!
27+
If you'd like to help, making a bugfix, making sure that it works, and opening a PR is a great step!
28+
29+
To find things to fix, go to the [tracking issue][tracking_issue], find an issue that you like, go there and claim that
30+
issue with `@rustbot claim`.
31+
32+
As a general metric and always taking into account your skill and knowledge level, you can use this guide:
33+
34+
- 🟥 [ICEs][search_ice], these are compiler errors that causes Clippy to panic and crash. Usually involves high-level
35+
debugging, sometimes interacting directly with the upstream compiler. Difficult to fix but a great challenge that
36+
improves a lot developer workflows!
37+
38+
- 🟧 [Suggestion causes bug][sugg_causes_bug], Clippy suggested code that changed logic in some silent way.
39+
Unacceptable, as this may have disastrous consequences. Easier to fix than ICEs
40+
41+
- 🟨 [Suggestion causes error][sugg_causes_error], Clippy suggested code snippet that caused a compiler error
42+
when applied. We need to make sure that Clippy doesn't suggest using a variable twice at the same time or similar
43+
easy-to-happen occurrences.
44+
45+
- 🟩 [False positives][false_positive], a lint should not have fired, the easiest of them all, as this is "just"
46+
identifying the root of a false positive and making an exception for those cases.
47+
48+
Note that false negatives do not have priority unless the case is very clear, as they are a feature-request in a
49+
trench coat.
50+
51+
[search_ice]: https://github.com/rust-lang/rust-clippy/issues?q=sort%3Aupdated-desc+state%3Aopen+label%3A%22I-ICE%22
52+
[sugg_causes_bug]: https://github.com/rust-lang/rust-clippy/issues?q=sort%3Aupdated-desc%20state%3Aopen%20label%3AI-suggestion-causes-bug
53+
[sugg_causes_error]: https://github.com/rust-lang/rust-clippy/issues?q=sort%3Aupdated-desc%20state%3Aopen%20label%3AI-suggestion-causes-error%20
54+
[false_positive]: https://github.com/rust-lang/rust-clippy/issues?q=sort%3Aupdated-desc%20state%3Aopen%20label%3AI-false-positive
55+
[tracking_issue]: https://github.com/rust-lang/rust-clippy/issues/15086

0 commit comments

Comments
 (0)