Skip to content

Commit e546279

Browse files
Auto-merged master into revert-bump_ui on deployment.
2 parents 3c596d0 + 94a000b commit e546279

File tree

457 files changed

+9418
-3358
lines changed

Some content is hidden

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

457 files changed

+9418
-3358
lines changed

.github/workflows/lintcheck.yml

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Lintcheck
2+
3+
on: pull_request
4+
5+
env:
6+
RUST_BACKTRACE: 1
7+
CARGO_INCREMENTAL: 0
8+
9+
concurrency:
10+
# For a given workflow, if we push to the same PR, cancel all previous builds on that PR.
11+
group: "${{ github.workflow }}-${{ github.event.pull_request.number}}"
12+
cancel-in-progress: true
13+
14+
jobs:
15+
# Runs lintcheck on the PR's target branch and stores the results as an artifact
16+
base:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 2
24+
25+
# HEAD is the generated merge commit `refs/pull/N/merge` between the PR and `master`, `HEAD^`
26+
# being the commit from `master` that is the base of the merge
27+
- name: Checkout base
28+
run: git checkout HEAD^
29+
30+
# Use the lintcheck from the PR to generate the JSON in case the PR modifies lintcheck in some
31+
# way
32+
- name: Checkout current lintcheck
33+
run: |
34+
rm -rf lintcheck
35+
git checkout ${{ github.sha }} -- lintcheck
36+
37+
- name: Cache lintcheck bin
38+
id: cache-lintcheck-bin
39+
uses: actions/cache@v4
40+
with:
41+
path: target/debug/lintcheck
42+
key: lintcheck-bin-${{ hashfiles('lintcheck/**') }}
43+
44+
- name: Build lintcheck
45+
if: steps.cache-lintcheck-bin.outputs.cache-hit != 'true'
46+
run: cargo build --manifest-path=lintcheck/Cargo.toml
47+
48+
- name: Create cache key
49+
id: key
50+
run: echo "key=lintcheck-base-${{ hashfiles('lintcheck/**') }}-$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
51+
52+
- name: Cache results JSON
53+
id: cache-json
54+
uses: actions/cache@v4
55+
with:
56+
path: lintcheck-logs/lintcheck_crates_logs.json
57+
key: ${{ steps.key.outputs.key }}
58+
59+
- name: Run lintcheck
60+
if: steps.cache-json.outputs.cache-hit != 'true'
61+
run: ./target/debug/lintcheck --format json
62+
63+
- name: Upload base JSON
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: base
67+
path: lintcheck-logs/lintcheck_crates_logs.json
68+
69+
# Runs lintcheck on the PR and stores the results as an artifact
70+
head:
71+
runs-on: ubuntu-latest
72+
73+
steps:
74+
- name: Checkout
75+
uses: actions/checkout@v4
76+
77+
- name: Cache lintcheck bin
78+
id: cache-lintcheck-bin
79+
uses: actions/cache@v4
80+
with:
81+
path: target/debug/lintcheck
82+
key: lintcheck-bin-${{ hashfiles('lintcheck/**') }}
83+
84+
- name: Build lintcheck
85+
if: steps.cache-lintcheck-bin.outputs.cache-hit != 'true'
86+
run: cargo build --manifest-path=lintcheck/Cargo.toml
87+
88+
- name: Run lintcheck
89+
run: ./target/debug/lintcheck --format json
90+
91+
- name: Upload head JSON
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: head
95+
path: lintcheck-logs/lintcheck_crates_logs.json
96+
97+
# Retrieves the head and base JSON results and prints the diff to the GH actions step summary
98+
diff:
99+
runs-on: ubuntu-latest
100+
101+
needs: [base, head]
102+
103+
steps:
104+
- name: Checkout
105+
uses: actions/checkout@v4
106+
107+
- name: Restore lintcheck bin
108+
uses: actions/cache/restore@v4
109+
with:
110+
path: target/debug/lintcheck
111+
key: lintcheck-bin-${{ hashfiles('lintcheck/**') }}
112+
fail-on-cache-miss: true
113+
114+
- name: Download JSON
115+
uses: actions/download-artifact@v4
116+
117+
- name: Diff results
118+
run: ./target/debug/lintcheck diff {base,head}/lintcheck_crates_logs.json >> $GITHUB_STEP_SUMMARY

CHANGELOG.md

+70-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,69 @@ document.
66

77
## Unreleased / Beta / In Rust Nightly
88

9-
[93f0a9a9...master](https://github.com/rust-lang/rust-clippy/compare/93f0a9a9...master)
9+
[ca3b3937...master](https://github.com/rust-lang/rust-clippy/compare/ca3b3937...master)
10+
11+
## Rust 1.79
12+
13+
Current stable, released 2024-06-13
14+
15+
[View all 102 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-03-08T11%3A13%3A58Z..2024-04-18T15%3A50%3A50Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
* Added [`legacy_numeric_constants`] to `style`
20+
[#12312](https://github.com/rust-lang/rust-clippy/pull/12312)
21+
* Added [`missing_transmute_annotations`] to `suspicious`
22+
[#12239](https://github.com/rust-lang/rust-clippy/pull/12239)
23+
* Added [`integer_division_remainder_used`] to `restriction`
24+
[#12451](https://github.com/rust-lang/rust-clippy/pull/12451)
25+
* Added [`duplicated_attributes`] to `suspicious`
26+
[#12378](https://github.com/rust-lang/rust-clippy/pull/12378)
27+
* Added [`manual_unwrap_or_default`] to `suspicious`
28+
[#12440](https://github.com/rust-lang/rust-clippy/pull/12440)
29+
* Added [`zero_repeat_side_effects`] to `suspicious`
30+
[#12449](https://github.com/rust-lang/rust-clippy/pull/12449)
31+
* Added [`const_is_empty`] to `suspicious`
32+
[#12310](https://github.com/rust-lang/rust-clippy/pull/12310)
33+
34+
### Moves and Deprecations
35+
36+
* Moved [`box_default`] to `style` (From `perf`)
37+
[#12601](https://github.com/rust-lang/rust-clippy/pull/12601)
38+
* Moved [`manual_clamp`] to `complexity` (From `nursery` now warn-by-default)
39+
[#12543](https://github.com/rust-lang/rust-clippy/pull/12543)
40+
* Moved [`readonly_write_lock`] to `perf` (From `nursery` now warn-by-default)
41+
[#12479](https://github.com/rust-lang/rust-clippy/pull/12479)
42+
43+
### Enhancements
44+
45+
* [`module_name_repetitions`]: Added the [`allowed-prefixes`] configuration to allow common prefixes.
46+
[#12573](https://github.com/rust-lang/rust-clippy/pull/12573)
47+
* [`cast_sign_loss`], [`cast_possible_truncation`], [`cast_lossless`]: Are now allowed in macros
48+
[#12631](https://github.com/rust-lang/rust-clippy/pull/12631)
49+
* [`manual_clamp`]: Now only lints on constant min and max values
50+
[#12543](https://github.com/rust-lang/rust-clippy/pull/12543)
51+
* [`assigning_clones`]: Now considers the [`msrv`] configuration
52+
[#12511](https://github.com/rust-lang/rust-clippy/pull/12511)
53+
* [`needless_return`], [`useless_let_if_seq`], [`mut_mut`], [`read_zero_byte_vec`], [`unused_io_amount`],
54+
[`unused_peekable`]: Now respects `#[allow]` attributes on the affected statement instead
55+
[#12446](https://github.com/rust-lang/rust-clippy/pull/12446)
56+
57+
### False Positive Fixes
58+
59+
* [`cast_lossless`]: No longer lints when casting to `u128`
60+
[#12496](https://github.com/rust-lang/rust-clippy/pull/12496)
61+
* [`std_instead_of_core`] No longer lints on modules that are only in `std`
62+
[#12447](https://github.com/rust-lang/rust-clippy/pull/12447)
63+
64+
### ICE Fixes
65+
66+
* [`needless_return`]: No longer crashes on non-ascii characters
67+
[#12493](https://github.com/rust-lang/rust-clippy/pull/12493)
1068

1169
## Rust 1.78
1270

13-
Current stable, released 2024-05-02
71+
Released 2024-05-02
1472

1573
[View all 112 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-01-26T05%3A46%3A23Z..2024-03-07T16%3A25%3A52Z+base%3Amaster)
1674

@@ -1885,7 +1943,7 @@ Released 2022-05-19
18851943
[#8218](https://github.com/rust-lang/rust-clippy/pull/8218)
18861944
* [`needless_match`]
18871945
[#8471](https://github.com/rust-lang/rust-clippy/pull/8471)
1888-
* [`allow_attributes_without_reason`] (Requires `#![feature(lint_reasons)]`)
1946+
* [`allow_attributes_without_reason`]
18891947
[#8504](https://github.com/rust-lang/rust-clippy/pull/8504)
18901948
* [`print_in_format_impl`]
18911949
[#8253](https://github.com/rust-lang/rust-clippy/pull/8253)
@@ -5178,6 +5236,7 @@ Released 2018-09-13
51785236
[`boxed_local`]: https://rust-lang.github.io/rust-clippy/master/index.html#boxed_local
51795237
[`branches_sharing_code`]: https://rust-lang.github.io/rust-clippy/master/index.html#branches_sharing_code
51805238
[`builtin_type_shadow`]: https://rust-lang.github.io/rust-clippy/master/index.html#builtin_type_shadow
5239+
[`byte_char_slices`]: https://rust-lang.github.io/rust-clippy/master/index.html#byte_char_slices
51815240
[`bytes_count_to_len`]: https://rust-lang.github.io/rust-clippy/master/index.html#bytes_count_to_len
51825241
[`bytes_nth`]: https://rust-lang.github.io/rust-clippy/master/index.html#bytes_nth
51835242
[`cargo_common_metadata`]: https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata
@@ -5195,6 +5254,7 @@ Released 2018-09-13
51955254
[`cast_sign_loss`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
51965255
[`cast_slice_different_sizes`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_different_sizes
51975256
[`cast_slice_from_raw_parts`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_from_raw_parts
5257+
[`cfg_not_test`]: https://rust-lang.github.io/rust-clippy/master/index.html#cfg_not_test
51985258
[`char_lit_as_u8`]: https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8
51995259
[`chars_last_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp
52005260
[`chars_next_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_next_cmp
@@ -5304,6 +5364,7 @@ Released 2018-09-13
53045364
[`extra_unused_type_parameters`]: https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_type_parameters
53055365
[`fallible_impl_from`]: https://rust-lang.github.io/rust-clippy/master/index.html#fallible_impl_from
53065366
[`field_reassign_with_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
5367+
[`field_scoped_visibility_modifiers`]: https://rust-lang.github.io/rust-clippy/master/index.html#field_scoped_visibility_modifiers
53075368
[`filetype_is_file`]: https://rust-lang.github.io/rust-clippy/master/index.html#filetype_is_file
53085369
[`filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map
53095370
[`filter_map_bool_then`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_bool_then
@@ -5462,6 +5523,7 @@ Released 2018-09-13
54625523
[`manual_find_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_find_map
54635524
[`manual_flatten`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten
54645525
[`manual_hash_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_hash_one
5526+
[`manual_inspect`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_inspect
54655527
[`manual_instant_elapsed`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_instant_elapsed
54665528
[`manual_is_ascii_check`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_ascii_check
54675529
[`manual_is_finite`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_finite
@@ -5474,10 +5536,12 @@ Released 2018-09-13
54745536
[`manual_next_back`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_next_back
54755537
[`manual_non_exhaustive`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive
54765538
[`manual_ok_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_or
5539+
[`manual_pattern_char_comparison`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_pattern_char_comparison
54775540
[`manual_range_contains`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
54785541
[`manual_range_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_patterns
54795542
[`manual_rem_euclid`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_rem_euclid
54805543
[`manual_retain`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_retain
5544+
[`manual_rotate`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_rotate
54815545
[`manual_saturating_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_saturating_arithmetic
54825546
[`manual_slice_size_calculation`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_slice_size_calculation
54835547
[`manual_split_once`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_split_once
@@ -5577,6 +5641,7 @@ Released 2018-09-13
55775641
[`needless_late_init`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
55785642
[`needless_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
55795643
[`needless_match`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_match
5644+
[`needless_maybe_sized`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_maybe_sized
55805645
[`needless_option_as_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_option_as_deref
55815646
[`needless_option_take`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_option_take
55825647
[`needless_parens_on_range_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_parens_on_range_literals
@@ -5735,6 +5800,7 @@ Released 2018-09-13
57355800
[`semicolon_outside_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_outside_block
57365801
[`separated_literal_suffix`]: https://rust-lang.github.io/rust-clippy/master/index.html#separated_literal_suffix
57375802
[`serde_api_misuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#serde_api_misuse
5803+
[`set_contains_or_insert`]: https://rust-lang.github.io/rust-clippy/master/index.html#set_contains_or_insert
57385804
[`shadow_reuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#shadow_reuse
57395805
[`shadow_same`]: https://rust-lang.github.io/rust-clippy/master/index.html#shadow_same
57405806
[`shadow_unrelated`]: https://rust-lang.github.io/rust-clippy/master/index.html#shadow_unrelated
@@ -5855,6 +5921,7 @@ Released 2018-09-13
58555921
[`unnecessary_lazy_evaluations`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
58565922
[`unnecessary_literal_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_unwrap
58575923
[`unnecessary_map_on_constructor`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_on_constructor
5924+
[`unnecessary_min_or_max`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_min_or_max
58585925
[`unnecessary_mut_passed`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
58595926
[`unnecessary_operation`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation
58605927
[`unnecessary_owned_empty_strings`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_owned_empty_strings

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.80"
3+
version = "0.1.81"
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"

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ You can add options to your code to `allow`/`warn`/`deny` Clippy lints:
172172

173173
Note: `allow` means to suppress the lint for your code. With `warn` the lint
174174
will only emit a warning, while with `deny` the lint will emit an error, when
175-
triggering for your code. An error causes clippy to exit with an error code, so
175+
triggering for your code. An error causes Clippy to exit with an error code, so
176176
is useful in scripts like CI/CD.
177177

178178
If you do not want to include your lint levels in your code, you can globally
@@ -238,7 +238,7 @@ define the `CLIPPY_DISABLE_DOCS_LINKS` environment variable.
238238
### Specifying the minimum supported Rust version
239239

240240
Projects that intend to support old versions of Rust can disable lints pertaining to newer features by
241-
specifying the minimum supported Rust version (MSRV) in the clippy configuration file.
241+
specifying the minimum supported Rust version (MSRV) in the Clippy configuration file.
242242

243243
```toml
244244
msrv = "1.30.0"

book/src/configuration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ For more details and options, refer to the Cargo documentation.
9999
### Specifying the minimum supported Rust version
100100

101101
Projects that intend to support old versions of Rust can disable lints pertaining to newer features by specifying the
102-
minimum supported Rust version (MSRV) in the clippy configuration file.
102+
minimum supported Rust version (MSRV) in the Clippy configuration file.
103103

104104
```toml
105105
msrv = "1.30.0"

book/src/development/basics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ More about [intellij] command usage and reasons.
107107

108108
## lintcheck
109109

110-
`cargo lintcheck` will build and run clippy on a fixed set of crates and
110+
`cargo lintcheck` will build and run Clippy on a fixed set of crates and
111111
generate a log of the results. You can `git diff` the updated log against its
112112
previous version and see what impact your lint made on a small set of crates.
113113
If you add a new lint, please audit the resulting warnings and make sure there

book/src/development/defining_lints.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ declare_clippy_lint! {
163163
///
164164
/// ### Example
165165
/// ```rust
166-
/// // example code where clippy issues a warning
166+
/// // example code where Clippy issues a warning
167167
/// ```
168168
/// Use instead:
169169
/// ```rust
170-
/// // example code which does not raise clippy warning
170+
/// // example code which does not raise Clippy warning
171171
/// ```
172172
#[clippy::version = "1.70.0"] // <- In which version was this implemented, keep it up to date!
173173
pub LINT_NAME, // <- The lint name IN_ALL_CAPS

book/src/development/proposals/syntax-tree-patterns.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ selection of possible matches is produced by the pattern syntax. In the second
428428
stage, the named subpattern references can be used to do additional tests like
429429
asserting that a node hasn't been created as part of a macro expansion.
430430

431-
## Implementing clippy lints using patterns
431+
## Implementing Clippy lints using patterns
432432

433433
As a "real-world" example, I re-implemented the `collapsible_if` lint using
434434
patterns. The code can be found
@@ -572,7 +572,7 @@ The pattern syntax and the *PatternTree* are independent of specific syntax tree
572572
implementations (rust ast / hir, syn, ...). When looking at the different
573573
pattern examples in the previous sections, it can be seen that the patterns
574574
don't contain any information specific to a certain syntax tree implementation.
575-
In contrast, clippy lints currently match against ast / hir syntax tree nodes
575+
In contrast, Clippy lints currently match against ast / hir syntax tree nodes
576576
and therefore directly depend on their implementation.
577577

578578
The connection between the *PatternTree* and specific syntax tree
@@ -690,7 +690,7 @@ change, only the `IsMatch` trait implementations need to be adapted and existing
690690
lints can remain unchanged. This also means that if the `IsMatch` trait
691691
implementations were integrated into the compiler, updating the `IsMatch`
692692
implementations would be required for the compiler to compile successfully. This
693-
could reduce the number of times clippy breaks because of changes in the
693+
could reduce the number of times Clippy breaks because of changes in the
694694
compiler. Another advantage of the pattern's independence is that converting an
695695
`EarlyLintPass` lint into a `LatePassLint` wouldn't require rewriting the whole
696696
pattern matching code. In fact, the pattern might work just fine without any
@@ -777,7 +777,7 @@ complexity to solve a relatively minor problem.
777777

778778
The issue of users not knowing about the *PatternTree* structure could be solved
779779
by a tool that, given a rust program, generates a pattern that matches only this
780-
program (similar to the clippy author lint).
780+
program (similar to the Clippy author lint).
781781

782782
For some simple cases (like the first example above), it might be possible to
783783
successfully mix Rust and pattern syntax. This space could be further explored
@@ -789,7 +789,7 @@ The pattern syntax is heavily inspired by regular expressions (repetitions,
789789
alternatives, sequences, ...).
790790

791791
From what I've seen until now, other linters also implement lints that directly
792-
work on syntax tree data structures, just like clippy does currently. I would
792+
work on syntax tree data structures, just like Clippy does currently. I would
793793
therefore consider the pattern syntax to be *new*, but please correct me if I'm
794794
wrong.
795795

@@ -982,5 +982,5 @@ pattern!{
982982
}
983983
```
984984

985-
In the future, clippy could use this system to also provide lints for custom
985+
In the future, Clippy could use this system to also provide lints for custom
986986
syntaxes like those found in macros.

0 commit comments

Comments
 (0)