Skip to content

Commit 88ab2d8

Browse files
committed
Auto merge of rust-lang#135297 - flip1995:clippy-subtree-update, r=matthiaskrgr
Clippy subtree update r? `@Manishearth`
2 parents 62bf38f + 43c3b30 commit 88ab2d8

File tree

147 files changed

+2004
-436
lines changed

Some content is hidden

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

147 files changed

+2004
-436
lines changed

Cargo.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
541541

542542
[[package]]
543543
name = "clippy"
544-
version = "0.1.85"
544+
version = "0.1.86"
545545
dependencies = [
546546
"anstream",
547547
"cargo_metadata 0.18.1",
@@ -572,7 +572,7 @@ dependencies = [
572572

573573
[[package]]
574574
name = "clippy_config"
575-
version = "0.1.85"
575+
version = "0.1.86"
576576
dependencies = [
577577
"clippy_utils",
578578
"itertools",
@@ -597,7 +597,7 @@ dependencies = [
597597

598598
[[package]]
599599
name = "clippy_lints"
600-
version = "0.1.85"
600+
version = "0.1.86"
601601
dependencies = [
602602
"arrayvec",
603603
"cargo_metadata 0.18.1",
@@ -620,7 +620,7 @@ dependencies = [
620620

621621
[[package]]
622622
name = "clippy_utils"
623-
version = "0.1.85"
623+
version = "0.1.86"
624624
dependencies = [
625625
"arrayvec",
626626
"itertools",

src/tools/clippy/.github/workflows/clippy_dev.yml

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
# Setup
1818
- name: Checkout
1919
uses: actions/checkout@v4
20+
with:
21+
# Unsetting this would make so that any malicious package could get our Github Token
22+
persist-credentials: false
2023

2124
# Run
2225
- name: Build

src/tools/clippy/.github/workflows/clippy_mq.yml

+22-5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
uses: actions/checkout@v4
2424
with:
2525
ref: ${{ github.ref }}
26+
# Unsetting this would make so that any malicious package could get our Github Token
27+
persist-credentials: false
2628

2729
# Run
2830
- name: Check Changelog
@@ -63,6 +65,8 @@ jobs:
6365
# Setup
6466
- name: Checkout
6567
uses: actions/checkout@v4
68+
with:
69+
persist-credentials: false
6670

6771
- name: Install i686 dependencies
6872
if: matrix.host == 'i686-unknown-linux-gnu'
@@ -74,7 +78,8 @@ jobs:
7478
- name: Install toolchain
7579
run: |
7680
rustup set default-host ${{ matrix.host }}
77-
rustup show active-toolchain
81+
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
82+
rustup show active-toolchain || rustup toolchain install
7883
7984
# Run
8085
- name: Build
@@ -121,9 +126,13 @@ jobs:
121126
# Setup
122127
- name: Checkout
123128
uses: actions/checkout@v4
129+
with:
130+
persist-credentials: false
124131

125132
- name: Install toolchain
126-
run: rustup show active-toolchain
133+
run: |
134+
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
135+
rustup show active-toolchain || rustup toolchain install
127136
128137
- name: Test metadata collection
129138
run: cargo collect-metadata
@@ -136,9 +145,13 @@ jobs:
136145
# Setup
137146
- name: Checkout
138147
uses: actions/checkout@v4
148+
with:
149+
persist-credentials: false
139150

140151
- name: Install toolchain
141-
run: rustup show active-toolchain
152+
run: |
153+
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
154+
rustup show active-toolchain || rustup toolchain install
142155
143156
# Run
144157
- name: Build Integration Test
@@ -188,9 +201,13 @@ jobs:
188201
# Setup
189202
- name: Checkout
190203
uses: actions/checkout@v4
204+
with:
205+
persist-credentials: false
191206

192207
- name: Install toolchain
193-
run: rustup show active-toolchain
208+
run: |
209+
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
210+
rustup show active-toolchain || rustup toolchain install
194211
195212
# Download
196213
- name: Download target dir
@@ -205,7 +222,7 @@ jobs:
205222
# Run
206223
- name: Test ${{ matrix.integration }}
207224
run: |
208-
TOOLCHAIN=$(rustup show active-toolchain | cut -f1 -d' ')
225+
TOOLCHAIN=$(rustup show active-toolchain | head -n 1 | cut -f1 -d' ')
209226
rustup run $TOOLCHAIN $CARGO_TARGET_DIR/debug/integration --show-output
210227
env:
211228
INTEGRATION: ${{ matrix.integration }}

src/tools/clippy/.github/workflows/clippy_pr.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ jobs:
2525
# Setup
2626
- name: Checkout
2727
uses: actions/checkout@v4
28+
with:
29+
# Unsetting this would make so that any malicious package could get our Github Token
30+
persist-credentials: false
2831

2932
- name: Install toolchain
30-
run: rustup show active-toolchain
33+
run: |
34+
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
35+
rustup show active-toolchain || rustup toolchain install
3136
3237
# Run
3338
- name: Build

src/tools/clippy/.github/workflows/deploy.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,27 @@ jobs:
2222
# Setup
2323
- name: Checkout
2424
uses: actions/checkout@v4
25+
with:
26+
# Unsetting this would make so that any malicious package could get our Github Token
27+
persist-credentials: false
2528

2629
- name: Checkout
2730
uses: actions/checkout@v4
2831
with:
2932
ref: ${{ env.TARGET_BRANCH }}
3033
path: 'out'
34+
# Unsetting this would make so that any malicious package could get our Github Token
35+
persist-credentials: false
3136

3237
# Run
3338
- name: Set tag name
3439
if: startswith(github.ref, 'refs/tags/')
3540
run: |
36-
TAG=$(basename ${{ github.ref }})
41+
TAG=$(basename "${TAGNAME}")
3742
echo "TAG_NAME=$TAG" >> $GITHUB_ENV
43+
env:
44+
# Make sure that the reference gets expanded before injecting it
45+
TAGNAME: ${{ github.ref }}
3846
- name: Set beta to true
3947
if: github.ref == 'refs/heads/beta'
4048
run: echo "BETA=true" >> $GITHUB_ENV

src/tools/clippy/.github/workflows/lintcheck.yml

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
uses: actions/checkout@v4
2222
with:
2323
fetch-depth: 2
24+
# Unsetting this would make so that any malicious package could get our Github Token
25+
persist-credentials: false
2426

2527
# HEAD is the generated merge commit `refs/pull/N/merge` between the PR and `master`, `HEAD^`
2628
# being the commit from `master` that is the base of the merge
@@ -73,6 +75,9 @@ jobs:
7375
steps:
7476
- name: Checkout
7577
uses: actions/checkout@v4
78+
with:
79+
# Unsetting this would make so that any malicious package could get our Github Token
80+
persist-credentials: false
7681

7782
- name: Cache lintcheck bin
7883
id: cache-lintcheck-bin
@@ -103,6 +108,9 @@ jobs:
103108
steps:
104109
- name: Checkout
105110
uses: actions/checkout@v4
111+
with:
112+
# Unsetting this would make so that any malicious package could get our Github Token
113+
persist-credentials: false
106114

107115
- name: Restore lintcheck bin
108116
uses: actions/cache/restore@v4

src/tools/clippy/.github/workflows/remark.yml

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
# Setup
1313
- name: Checkout
1414
uses: actions/checkout@v4
15+
with:
16+
# Unsetting this would make so that any malicious package could get our Github Token
17+
persist-credentials: false
1518

1619
- name: Setup Node.js
1720
uses: actions/setup-node@v4

src/tools/clippy/CHANGELOG.md

+45-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,52 @@ document.
66

77
## Unreleased / Beta / In Rust Nightly
88

9-
[aa0d5513...master](https://github.com/rust-lang/rust-clippy/compare/aa0d5513...master)
9+
[786fbd6d...master](https://github.com/rust-lang/rust-clippy/compare/786fbd6d...master)
10+
11+
## Rust 1.84
12+
13+
Current stable, released 2025-01-09
14+
15+
[View all 84 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-10-03T21%3A23%3A58Z..2024-11-14T17%3A41%3A37Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
* Added [`unnecessary_map_or`] to `style`
20+
[#11796](https://github.com/rust-lang/rust-clippy/pull/11796)
21+
* Added [`arbitrary_source_item_ordering`] to `restriction`
22+
[#13376](https://github.com/rust-lang/rust-clippy/pull/13376)
23+
* Added [`map_with_unused_argument_over_ranges`] to `restriction`
24+
[#13034](https://github.com/rust-lang/rust-clippy/pull/13034)
25+
* Added [`map_all_any_identity`] to `complexity`
26+
[#13499](https://github.com/rust-lang/rust-clippy/pull/13499)
27+
* Added [`needless_as_bytes`] to `complexity`
28+
[#13437](https://github.com/rust-lang/rust-clippy/pull/13437)
29+
* Added [`unnecessary_literal_bound`] to `pedantic`
30+
[#13395](https://github.com/rust-lang/rust-clippy/pull/13395)
31+
* Added [`manual_ignore_case_cmp`] to `perf`
32+
[#13334](https://github.com/rust-lang/rust-clippy/pull/13334)
33+
* Added [`regex_creation_in_loops`] to `perf`
34+
[#13412](https://github.com/rust-lang/rust-clippy/pull/13412)
35+
36+
### Moves and Deprecations
37+
38+
* Moved [`manual_is_power_of_two`] to `pedantic` (From `complexity`, now allow-by-default)
39+
[#13553](https://github.com/rust-lang/rust-clippy/pull/13553)
40+
* Move [`module_name_repetitions`] to `restriction` (from `pedantic`)
41+
[#13541](https://github.com/rust-lang/rust-clippy/pull/13541)
42+
43+
### Enhancements
44+
45+
* [`doc_markdown`]: Added the following identifiers to [`doc-valid-idents`]:
46+
CoAP, MHz, GHz, and THz
47+
[#13633](https://github.com/rust-lang/rust-clippy/pull/13633)
48+
[#13460](https://github.com/rust-lang/rust-clippy/pull/13460)
49+
* [`large_const_arrays`]: Changed the default of [`array-size-threshold`] to `16kb` (from `512kb`)
50+
[#13485](https://github.com/rust-lang/rust-clippy/pull/13485)
1051

1152
## Rust 1.83
1253

13-
Current stable, released 2024-11-28
54+
Released 2024-11-28
1455

1556
[View all 64 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-08-25T09%3A59%3A01Z..2024-10-03T13%3A42%3A56Z+base%3Amaster)
1657

@@ -5493,6 +5534,7 @@ Released 2018-09-13
54935534
[`doc_markdown`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
54945535
[`doc_nested_refdefs`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_nested_refdefs
54955536
[`double_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_comparisons
5537+
[`double_ended_iterator_last`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last
54965538
[`double_must_use`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_must_use
54975539
[`double_neg`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_neg
54985540
[`double_parens`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_parens
@@ -6252,6 +6294,7 @@ Released 2018-09-13
62526294
[`future-size-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#future-size-threshold
62536295
[`ignore-interior-mutability`]: https://doc.rust-lang.org/clippy/lint_configuration.html#ignore-interior-mutability
62546296
[`large-error-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#large-error-threshold
6297+
[`lint-inconsistent-struct-field-initializers`]: https://doc.rust-lang.org/clippy/lint_configuration.html#lint-inconsistent-struct-field-initializers
62556298
[`literal-representation-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#literal-representation-threshold
62566299
[`matches-for-let-else`]: https://doc.rust-lang.org/clippy/lint_configuration.html#matches-for-let-else
62576300
[`max-fn-params-bools`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-fn-params-bools

src/tools/clippy/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy"
33
# begin autogenerated version
4-
version = "0.1.85"
4+
version = "0.1.86"
55
# end autogenerated version
66
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
77
repository = "https://github.com/rust-lang/rust-clippy"

src/tools/clippy/book/src/development/infrastructure/changelog_update.md

+5
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ As section headers, we use:
8383

8484
```
8585
### New Lints
86+
* Added [`LINT`] to `GROUP`
87+
8688
### Moves and Deprecations
89+
* Moved [`LINT`] to `GROUP` (From `GROUP`, now LEVEL-by-default)
90+
* Renamed `LINT` to [`LINT`]
91+
8792
### Enhancements
8893
### False Positive Fixes
8994
### Suggestion Fixes/Improvements

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use clippy_utils::is_trait_method;
2121
impl<'tcx> LateLintPass<'tcx> for OurFancyMethodLint {
2222
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
2323
// Check our expr is calling a method with pattern matching
24-
if let hir::ExprKind::MethodCall(path, _, [self_arg, ..]) = &expr.kind
24+
if let hir::ExprKind::MethodCall(path, _, [self_arg, ..], _) = &expr.kind
2525
// Check if the name of this method is `our_fancy_method`
2626
&& path.ident.name.as_str() == "our_fancy_method"
2727
// We can check the type of the self argument whenever necessary.

src/tools/clippy/book/src/lint_configuration.md

+27
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,33 @@ The maximum size of the `Err`-variant in a `Result` returned from a function
582582
* [`result_large_err`](https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err)
583583

584584

585+
## `lint-inconsistent-struct-field-initializers`
586+
Whether to suggest reordering constructor fields when initializers are present.
587+
588+
Warnings produced by this configuration aren't necessarily fixed by just reordering the fields. Even if the
589+
suggested code would compile, it can change semantics if the initializer expressions have side effects. The
590+
following example [from rust-clippy#11846] shows how the suggestion can run into borrow check errors:
591+
592+
```rust
593+
struct MyStruct {
594+
vector: Vec<u32>,
595+
length: usize
596+
}
597+
fn main() {
598+
let vector = vec![1,2,3];
599+
MyStruct { length: vector.len(), vector};
600+
}
601+
```
602+
603+
[from rust-clippy#11846]: https://github.com/rust-lang/rust-clippy/issues/11846#issuecomment-1820747924
604+
605+
**Default Value:** `false`
606+
607+
---
608+
**Affected lints:**
609+
* [`inconsistent_struct_constructor`](https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_struct_constructor)
610+
611+
585612
## `literal-representation-threshold`
586613
The lower bound for linting decimal literals
587614

src/tools/clippy/clippy.toml

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
avoid-breaking-exported-api = false
22

3+
lint-inconsistent-struct-field-initializers = true
4+
35
[[disallowed-methods]]
46
path = "rustc_lint::context::LintContext::lint"
57
reason = "this function does not add a link to our documentation, please use the `clippy_utils::diagnostics::span_lint*` functions instead"

src/tools/clippy/clippy_config/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_config"
33
# begin autogenerated version
4-
version = "0.1.85"
4+
version = "0.1.86"
55
# end autogenerated version
66
edition = "2021"
77
publish = false

src/tools/clippy/clippy_config/src/conf.rs

+20
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,26 @@ define_Conf! {
532532
/// The maximum size of the `Err`-variant in a `Result` returned from a function
533533
#[lints(result_large_err)]
534534
large_error_threshold: u64 = 128,
535+
/// Whether to suggest reordering constructor fields when initializers are present.
536+
///
537+
/// Warnings produced by this configuration aren't necessarily fixed by just reordering the fields. Even if the
538+
/// suggested code would compile, it can change semantics if the initializer expressions have side effects. The
539+
/// following example [from rust-clippy#11846] shows how the suggestion can run into borrow check errors:
540+
///
541+
/// ```rust
542+
/// struct MyStruct {
543+
/// vector: Vec<u32>,
544+
/// length: usize
545+
/// }
546+
/// fn main() {
547+
/// let vector = vec![1,2,3];
548+
/// MyStruct { length: vector.len(), vector};
549+
/// }
550+
/// ```
551+
///
552+
/// [from rust-clippy#11846]: https://github.com/rust-lang/rust-clippy/issues/11846#issuecomment-1820747924
553+
#[lints(inconsistent_struct_constructor)]
554+
lint_inconsistent_struct_field_initializers: bool = false,
535555
/// The lower bound for linting decimal literals
536556
#[lints(decimal_literal_representation)]
537557
literal_representation_threshold: u64 = 16384,

0 commit comments

Comments
 (0)