Skip to content

Clippy subtree update #135297

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

Merged
merged 82 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
a5d5edc
Do not trigger trailing_empty_array in tests
alex-semenyuk Dec 17, 2024
639f405
Remove obsolete comment
samueltardieu Dec 17, 2024
15ab2ff
use the correct `ParamEnv` when checking future's return type in `mis…
y21 Dec 21, 2024
de86302
correct suggestion for manual_div_ceil lint
lapla-cogito Dec 22, 2024
71f1a87
remove known problems section from match_same_arms
lapla-cogito Dec 24, 2024
be09596
Examples fixes for regex
alex-semenyuk Dec 24, 2024
1cc5051
Merge commit '609cd310be44677ae31d452a17b0f8207e1abfe1' into clippy-s…
flip1995 Dec 26, 2024
8a38bcc
Make "all fields are shorthand" requirement configurable
smoelius Nov 26, 2024
553a381
Remove obsolete comment (#13850)
y21 Dec 27, 2024
4be0e62
correct suggestion for `manual_div_ceil` lint (#13864)
xFrednet Dec 27, 2024
363e61d
remove description of known problems in `match_same_arms` that have a…
xFrednet Dec 27, 2024
a8968e5
Make `inconsistent_struct_constructor` "all fields are shorthand" req…
y21 Dec 27, 2024
09022bb
fix arguments of ExprKind::MethodCall
lapla-cogito Dec 28, 2024
998c780
fix arguments of `ExprKind::MethodCall` (#13890)
flip1995 Dec 28, 2024
e582fcd
[`needless_continue`]: lint if the last stmt in for/while/loop is `co…
lengyijun Sep 20, 2023
d7cc6c4
borrow_interior_mutable_const ICE into FN
blyxyas Dec 25, 2024
786f090
Do not trigger `trailing_empty_array` in tests (#13844)
llogiq Dec 29, 2024
aef4772
Examples fixes for regex (#13874)
dswij Dec 29, 2024
c8ba3e1
use the correct `ParamEnv` when checking future's output type (#13863)
dswij Dec 29, 2024
eef47fc
Do not remove required parentheses in `borrow_as_ptr` suggestion
samueltardieu Dec 27, 2024
f5f1abd
`borrow_interior_mutable_const` ICE into FN (#13877)
xFrednet Dec 29, 2024
b57d98b
Do not remove required parentheses in `borrow_as_ptr` suggestion (#13…
blyxyas Dec 29, 2024
34b1765
Move more def paths into `clippy_utils::paths`
GuillaumeGomez Dec 29, 2024
a9fe043
Do not remove identity mapping if mandatory mutability would be lost
samueltardieu Dec 29, 2024
e4b11a7
Fix parentheses when replacing `matches!(…, None)` with `.is_none()`
samueltardieu Dec 29, 2024
a657fcc
Use the full lifetime name in suggestions
samueltardieu Dec 29, 2024
b515064
Correctly handle `char` paths
GuillaumeGomez Dec 30, 2024
be49f86
Move more def paths into `clippy_utils::paths` (#13903)
y21 Dec 30, 2024
2aea7a0
Fix parentheses when replacing `matches!(…, None)` with `.is_none()` …
y21 Dec 30, 2024
7a834b5
Use the full lifetime name in suggestions (#13907)
Manishearth Dec 30, 2024
4899333
better suggestion for slow_vector_initialization
lapla-cogito Dec 31, 2024
1e0b782
add test for ICE
matthiaskrgr Dec 31, 2024
2a4dadd
fix type suggestion for manual_is_ascii_check (#13913)
Otto-AA Dec 31, 2024
c52740c
add test for ICE (#13914)
dswij Dec 31, 2024
3bc089e
refactor manual_is_ascii_check to remove unused parameter
Otto-AA Dec 31, 2024
54e5116
cover guard patterns in clippy lints
max-niederman Oct 6, 2024
4c9c2cc
Check if deref target implements `is_empty` for `len_zero` lint
samueltardieu Dec 23, 2024
33a6590
Check if deref target implements `is_empty` for `len_zero` lint (#13871)
blyxyas Jan 1, 2025
707653f
Add lint for calling last() on DoubleEndedIterator
qsantos Jan 1, 2025
458c955
Fix conflicts with double_ended_iterator_last
qsantos Jan 1, 2025
09c5d34
Dogfood double_ended_iterator_last
qsantos Jan 1, 2025
034f3d2
Improve `slow_vector_initialization` suggestion (#13912)
blyxyas Jan 1, 2025
27acfd8
Prefer if chain to let-else
qsantos Jan 1, 2025
7331cc0
Only complain about default Iterator::last()
qsantos Jan 1, 2025
0d213aa
Revert "Dogfood double_ended_iterator_last"
qsantos Jan 1, 2025
d67c00f
Dogfood double_ended_iterator_last
qsantos Jan 1, 2025
f18399f
Emit redundant if when duplicated in `needless_continue`
profetia Dec 28, 2024
631d9a2
Add lint for calling `Iterator::last()` on `DoubleEndedIterator` (#13…
Manishearth Jan 2, 2025
9c46e11
Remove unneeded parentheses in `unnecessary_map_or` lint output
samueltardieu Jan 2, 2025
7ac1515
Make CI a little bit safer
blyxyas Jan 2, 2025
7a01033
Make CI a little bit safer (#13933)
blyxyas Jan 3, 2025
ad36f2b
turn rustc_box into an intrinsic
RalfJung Jan 2, 2025
4736004
Update version attribute for 1.84 clippy lints
xFrednet Jan 3, 2025
4e4a2d0
Changelog for Clippy 1.84 :firecracker:
xFrednet Jan 3, 2025
1b85ae3
Only emit `useless_vec` suggestion if the macro does not contain code…
GuillaumeGomez Dec 30, 2024
b76e042
Add regression test for `useless_vec` with code comments
GuillaumeGomez Dec 30, 2024
f416f26
turn hir::ItemKind::Fn into a named-field variant
RalfJung Jan 4, 2025
5262111
Rollup merge of #135046 - RalfJung:rustc_box_intrinsic, r=compiler-er…
workingjubilee Jan 4, 2025
622382b
Fix year in CHANGELOG.md
xFrednet Jan 4, 2025
54f88c3
[`needless_continue`]: lint if the last stmt in loop is `continue` re…
blyxyas Jan 4, 2025
12d3137
CI: be compatible with both Rustup pre-1.28.0 and 1.28.0
samueltardieu Jan 4, 2025
ad69c65
Only emit `useless_vec` suggestion if the macro does not contain code…
xFrednet Jan 4, 2025
ca55534
Do not trigger clippy::missing_const_for_fn triggering for tests
alex-semenyuk Jan 4, 2025
a9c0e22
Changelog for Clippy 1.84 🧨 (#13937)
Centri3 Jan 6, 2025
891e387
Don't emit machine applicable `map_flatten` lint if there are code co…
GuillaumeGomez Jan 4, 2025
78225cc
Add regression test for #8528
GuillaumeGomez Jan 4, 2025
0e2505b
Do not trigger `missing_const_for_fn` for tests (#13945)
Manishearth Jan 6, 2025
63487dd
`clippy::redundant_locals` is not a correctness lint
hrxi Nov 28, 2024
98b9a26
`clippy::redundant_locals` is not a correctness lint (#13747)
Centri3 Jan 7, 2025
d0d5b8a
Don't emit machine applicable `map_flatten` lint if there are code co…
xFrednet Jan 7, 2025
4ef9177
CI: be compatible with both Rustup pre-1.28.0 and 1.28.0 (#13944)
flip1995 Jan 7, 2025
b7b69b1
Remove unneeded parentheses in `unnecessary_map_or` lint output (#13932)
Alexendoo Jan 7, 2025
f5ca68f
Do not remove identity mapping if mandatory mutability would be lost …
Alexendoo Jan 7, 2025
11f38ad
Rollup merge of #134989 - max-niederman:guard-patterns-hir, r=oli-obk
matthiaskrgr Jan 7, 2025
8461d3f
Remove unnecessary string allocation
Otto-AA Jan 8, 2025
894e87c
Fix type suggestion for manual_is_ascii_check (#13916)
Alexendoo Jan 8, 2025
b5bf09e
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Jan 9, 2025
bb4a259
Bump nightly version -> 2024-01-09
flip1995 Jan 9, 2025
663892b
Bump Clippy version -> 0.1.86
flip1995 Jan 9, 2025
19e305b
Rustup (#13970)
flip1995 Jan 9, 2025
573db1c
Merge commit '19e305bb57a7595f2a8d81f521c0dd8bf854e739' into clippy-s…
flip1995 Jan 9, 2025
43c3b30
Update Cargo.lock
flip1995 Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"

[[package]]
name = "clippy"
version = "0.1.85"
version = "0.1.86"
dependencies = [
"anstream",
"cargo_metadata 0.18.1",
Expand Down Expand Up @@ -572,7 +572,7 @@ dependencies = [

[[package]]
name = "clippy_config"
version = "0.1.85"
version = "0.1.86"
dependencies = [
"clippy_utils",
"itertools",
Expand All @@ -597,7 +597,7 @@ dependencies = [

[[package]]
name = "clippy_lints"
version = "0.1.85"
version = "0.1.86"
dependencies = [
"arrayvec",
"cargo_metadata 0.18.1",
Expand All @@ -620,7 +620,7 @@ dependencies = [

[[package]]
name = "clippy_utils"
version = "0.1.85"
version = "0.1.86"
dependencies = [
"arrayvec",
"itertools",
Expand Down
3 changes: 3 additions & 0 deletions src/tools/clippy/.github/workflows/clippy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
# Setup
- name: Checkout
uses: actions/checkout@v4
with:
# Unsetting this would make so that any malicious package could get our Github Token
persist-credentials: false

# Run
- name: Build
Expand Down
27 changes: 22 additions & 5 deletions src/tools/clippy/.github/workflows/clippy_mq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
# Unsetting this would make so that any malicious package could get our Github Token
persist-credentials: false

# Run
- name: Check Changelog
Expand Down Expand Up @@ -63,6 +65,8 @@ jobs:
# Setup
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install i686 dependencies
if: matrix.host == 'i686-unknown-linux-gnu'
Expand All @@ -74,7 +78,8 @@ jobs:
- name: Install toolchain
run: |
rustup set default-host ${{ matrix.host }}
rustup show active-toolchain
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
rustup show active-toolchain || rustup toolchain install

# Run
- name: Build
Expand Down Expand Up @@ -121,9 +126,13 @@ jobs:
# Setup
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install toolchain
run: rustup show active-toolchain
run: |
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
rustup show active-toolchain || rustup toolchain install

- name: Test metadata collection
run: cargo collect-metadata
Expand All @@ -136,9 +145,13 @@ jobs:
# Setup
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install toolchain
run: rustup show active-toolchain
run: |
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
rustup show active-toolchain || rustup toolchain install

# Run
- name: Build Integration Test
Expand Down Expand Up @@ -188,9 +201,13 @@ jobs:
# Setup
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install toolchain
run: rustup show active-toolchain
run: |
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
rustup show active-toolchain || rustup toolchain install

# Download
- name: Download target dir
Expand All @@ -205,7 +222,7 @@ jobs:
# Run
- name: Test ${{ matrix.integration }}
run: |
TOOLCHAIN=$(rustup show active-toolchain | cut -f1 -d' ')
TOOLCHAIN=$(rustup show active-toolchain | head -n 1 | cut -f1 -d' ')
rustup run $TOOLCHAIN $CARGO_TARGET_DIR/debug/integration --show-output
env:
INTEGRATION: ${{ matrix.integration }}
Expand Down
7 changes: 6 additions & 1 deletion src/tools/clippy/.github/workflows/clippy_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ jobs:
# Setup
- name: Checkout
uses: actions/checkout@v4
with:
# Unsetting this would make so that any malicious package could get our Github Token
persist-credentials: false

- name: Install toolchain
run: rustup show active-toolchain
run: |
# Use a way compatible with Rustup pre-1.28.0 and Rustup 1.28.0
rustup show active-toolchain || rustup toolchain install

# Run
- name: Build
Expand Down
10 changes: 9 additions & 1 deletion src/tools/clippy/.github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,27 @@ jobs:
# Setup
- name: Checkout
uses: actions/checkout@v4
with:
# Unsetting this would make so that any malicious package could get our Github Token
persist-credentials: false

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

# Run
- name: Set tag name
if: startswith(github.ref, 'refs/tags/')
run: |
TAG=$(basename ${{ github.ref }})
TAG=$(basename "${TAGNAME}")
echo "TAG_NAME=$TAG" >> $GITHUB_ENV
env:
# Make sure that the reference gets expanded before injecting it
TAGNAME: ${{ github.ref }}
- name: Set beta to true
if: github.ref == 'refs/heads/beta'
run: echo "BETA=true" >> $GITHUB_ENV
Expand Down
8 changes: 8 additions & 0 deletions src/tools/clippy/.github/workflows/lintcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 2
# Unsetting this would make so that any malicious package could get our Github Token
persist-credentials: false

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

- name: Cache lintcheck bin
id: cache-lintcheck-bin
Expand Down Expand Up @@ -103,6 +108,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Unsetting this would make so that any malicious package could get our Github Token
persist-credentials: false

- name: Restore lintcheck bin
uses: actions/cache/restore@v4
Expand Down
3 changes: 3 additions & 0 deletions src/tools/clippy/.github/workflows/remark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
# Setup
- name: Checkout
uses: actions/checkout@v4
with:
# Unsetting this would make so that any malicious package could get our Github Token
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
Expand Down
47 changes: 45 additions & 2 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,52 @@ document.

## Unreleased / Beta / In Rust Nightly

[aa0d5513...master](https://github.com/rust-lang/rust-clippy/compare/aa0d5513...master)
[786fbd6d...master](https://github.com/rust-lang/rust-clippy/compare/786fbd6d...master)

## Rust 1.84

Current stable, released 2025-01-09

[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)

### New Lints

* Added [`unnecessary_map_or`] to `style`
[#11796](https://github.com/rust-lang/rust-clippy/pull/11796)
* Added [`arbitrary_source_item_ordering`] to `restriction`
[#13376](https://github.com/rust-lang/rust-clippy/pull/13376)
* Added [`map_with_unused_argument_over_ranges`] to `restriction`
[#13034](https://github.com/rust-lang/rust-clippy/pull/13034)
* Added [`map_all_any_identity`] to `complexity`
[#13499](https://github.com/rust-lang/rust-clippy/pull/13499)
* Added [`needless_as_bytes`] to `complexity`
[#13437](https://github.com/rust-lang/rust-clippy/pull/13437)
* Added [`unnecessary_literal_bound`] to `pedantic`
[#13395](https://github.com/rust-lang/rust-clippy/pull/13395)
* Added [`manual_ignore_case_cmp`] to `perf`
[#13334](https://github.com/rust-lang/rust-clippy/pull/13334)
* Added [`regex_creation_in_loops`] to `perf`
[#13412](https://github.com/rust-lang/rust-clippy/pull/13412)

### Moves and Deprecations

* Moved [`manual_is_power_of_two`] to `pedantic` (From `complexity`, now allow-by-default)
[#13553](https://github.com/rust-lang/rust-clippy/pull/13553)
* Move [`module_name_repetitions`] to `restriction` (from `pedantic`)
[#13541](https://github.com/rust-lang/rust-clippy/pull/13541)

### Enhancements

* [`doc_markdown`]: Added the following identifiers to [`doc-valid-idents`]:
CoAP, MHz, GHz, and THz
[#13633](https://github.com/rust-lang/rust-clippy/pull/13633)
[#13460](https://github.com/rust-lang/rust-clippy/pull/13460)
* [`large_const_arrays`]: Changed the default of [`array-size-threshold`] to `16kb` (from `512kb`)
[#13485](https://github.com/rust-lang/rust-clippy/pull/13485)

## Rust 1.83

Current stable, released 2024-11-28
Released 2024-11-28

[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)

Expand Down Expand Up @@ -5493,6 +5534,7 @@ Released 2018-09-13
[`doc_markdown`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
[`doc_nested_refdefs`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_nested_refdefs
[`double_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_comparisons
[`double_ended_iterator_last`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last
[`double_must_use`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_must_use
[`double_neg`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_neg
[`double_parens`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_parens
Expand Down Expand Up @@ -6252,6 +6294,7 @@ Released 2018-09-13
[`future-size-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#future-size-threshold
[`ignore-interior-mutability`]: https://doc.rust-lang.org/clippy/lint_configuration.html#ignore-interior-mutability
[`large-error-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#large-error-threshold
[`lint-inconsistent-struct-field-initializers`]: https://doc.rust-lang.org/clippy/lint_configuration.html#lint-inconsistent-struct-field-initializers
[`literal-representation-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#literal-representation-threshold
[`matches-for-let-else`]: https://doc.rust-lang.org/clippy/lint_configuration.html#matches-for-let-else
[`max-fn-params-bools`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-fn-params-bools
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "clippy"
# begin autogenerated version
version = "0.1.85"
version = "0.1.86"
# end autogenerated version
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ As section headers, we use:

```
### New Lints
* Added [`LINT`] to `GROUP`

### Moves and Deprecations
* Moved [`LINT`] to `GROUP` (From `GROUP`, now LEVEL-by-default)
* Renamed `LINT` to [`LINT`]

### Enhancements
### False Positive Fixes
### Suggestion Fixes/Improvements
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/book/src/development/method_checking.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use clippy_utils::is_trait_method;
impl<'tcx> LateLintPass<'tcx> for OurFancyMethodLint {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
// Check our expr is calling a method with pattern matching
if let hir::ExprKind::MethodCall(path, _, [self_arg, ..]) = &expr.kind
if let hir::ExprKind::MethodCall(path, _, [self_arg, ..], _) = &expr.kind
// Check if the name of this method is `our_fancy_method`
&& path.ident.name.as_str() == "our_fancy_method"
// We can check the type of the self argument whenever necessary.
Expand Down
27 changes: 27 additions & 0 deletions src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,33 @@ The maximum size of the `Err`-variant in a `Result` returned from a function
* [`result_large_err`](https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err)


## `lint-inconsistent-struct-field-initializers`
Whether to suggest reordering constructor fields when initializers are present.

Warnings produced by this configuration aren't necessarily fixed by just reordering the fields. Even if the
suggested code would compile, it can change semantics if the initializer expressions have side effects. The
following example [from rust-clippy#11846] shows how the suggestion can run into borrow check errors:

```rust
struct MyStruct {
vector: Vec<u32>,
length: usize
}
fn main() {
let vector = vec![1,2,3];
MyStruct { length: vector.len(), vector};
}
```

[from rust-clippy#11846]: https://github.com/rust-lang/rust-clippy/issues/11846#issuecomment-1820747924

**Default Value:** `false`

---
**Affected lints:**
* [`inconsistent_struct_constructor`](https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_struct_constructor)


## `literal-representation-threshold`
The lower bound for linting decimal literals

Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/clippy.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
avoid-breaking-exported-api = false

lint-inconsistent-struct-field-initializers = true

[[disallowed-methods]]
path = "rustc_lint::context::LintContext::lint"
reason = "this function does not add a link to our documentation, please use the `clippy_utils::diagnostics::span_lint*` functions instead"
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "clippy_config"
# begin autogenerated version
version = "0.1.85"
version = "0.1.86"
# end autogenerated version
edition = "2021"
publish = false
Expand Down
20 changes: 20 additions & 0 deletions src/tools/clippy/clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,26 @@ define_Conf! {
/// The maximum size of the `Err`-variant in a `Result` returned from a function
#[lints(result_large_err)]
large_error_threshold: u64 = 128,
/// Whether to suggest reordering constructor fields when initializers are present.
///
/// Warnings produced by this configuration aren't necessarily fixed by just reordering the fields. Even if the
/// suggested code would compile, it can change semantics if the initializer expressions have side effects. The
/// following example [from rust-clippy#11846] shows how the suggestion can run into borrow check errors:
///
/// ```rust
/// struct MyStruct {
/// vector: Vec<u32>,
/// length: usize
/// }
/// fn main() {
/// let vector = vec![1,2,3];
/// MyStruct { length: vector.len(), vector};
/// }
/// ```
///
/// [from rust-clippy#11846]: https://github.com/rust-lang/rust-clippy/issues/11846#issuecomment-1820747924
#[lints(inconsistent_struct_constructor)]
lint_inconsistent_struct_field_initializers: bool = false,
/// The lower bound for linting decimal literals
#[lints(decimal_literal_representation)]
literal_representation_threshold: u64 = 16384,
Expand Down
Loading
Loading