Skip to content

Commit 8ab22a4

Browse files
committed
Merge remote-tracking branch 'origin' into trivial_map_over_range
2 parents 90ea628 + 94099f4 commit 8ab22a4

File tree

635 files changed

+13718
-11681
lines changed

Some content is hidden

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

635 files changed

+13718
-11681
lines changed

.cargo/config.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ uibless = "test --test compile-test -- -- --bless"
44
bless = "test -- -- --bless"
55
dev = "run --package clippy_dev --bin clippy_dev --manifest-path clippy_dev/Cargo.toml --"
66
lintcheck = "run --package lintcheck --bin lintcheck --manifest-path lintcheck/Cargo.toml -- "
7-
collect-metadata = "test --test dogfood --features internal -- run_metadata_collection_lint --ignored"
7+
collect-metadata = "test --test dogfood --features internal -- collect_metadata"
88

99
[build]
1010
# -Zbinary-dep-depinfo allows us to track which rlib files to use for compiling UI tests
@@ -13,6 +13,13 @@ target-dir = "target"
1313

1414
[unstable]
1515
binary-dep-depinfo = true
16+
profile-rustflags = true
1617

1718
[profile.dev]
1819
split-debuginfo = "unpacked"
20+
21+
# Add back the containing directory of the packages we have to refer to using --manifest-path
22+
[profile.dev.package.clippy_dev]
23+
rustflags = ["--remap-path-prefix", "=clippy_dev"]
24+
[profile.dev.package.lintcheck]
25+
rustflags = ["--remap-path-prefix", "=lintcheck"]

.github/workflows/clippy.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ env:
2525
CARGO_TARGET_DIR: '${{ github.workspace }}/target'
2626
NO_FMT_TEST: 1
2727
CARGO_INCREMENTAL: 0
28+
RUSTFLAGS: -D warnings
2829

2930
concurrency:
3031
# For a given workflow, if we push to the same PR, cancel all previous builds on that PR.
@@ -47,25 +48,25 @@ jobs:
4748

4849
# Run
4950
- name: Build
50-
run: cargo build --tests --features deny-warnings,internal
51+
run: cargo build --tests --features internal
5152

5253
- name: Test
53-
run: cargo test --features deny-warnings,internal
54+
run: cargo test --features internal
5455

5556
- name: Test clippy_lints
56-
run: cargo test --features deny-warnings,internal
57+
run: cargo test --features internal
5758
working-directory: clippy_lints
5859

5960
- name: Test clippy_utils
60-
run: cargo test --features deny-warnings
61+
run: cargo test
6162
working-directory: clippy_utils
6263

6364
- name: Test rustc_tools_util
64-
run: cargo test --features deny-warnings
65+
run: cargo test
6566
working-directory: rustc_tools_util
6667

6768
- name: Test clippy_dev
68-
run: cargo test --features deny-warnings
69+
run: cargo test
6970
working-directory: clippy_dev
7071

7172
- name: Test clippy-driver

.github/workflows/clippy_bors.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ env:
1111
CARGO_TARGET_DIR: '${{ github.workspace }}/target'
1212
NO_FMT_TEST: 1
1313
CARGO_INCREMENTAL: 0
14+
RUSTFLAGS: -D warnings
1415

1516
concurrency:
1617
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch.
@@ -85,34 +86,34 @@ jobs:
8586
8687
# Run
8788
- name: Build
88-
run: cargo build --tests --features deny-warnings,internal
89+
run: cargo build --tests --features internal
8990

9091
- name: Test
9192
if: matrix.host == 'x86_64-unknown-linux-gnu'
92-
run: cargo test --features deny-warnings,internal
93+
run: cargo test --features internal
9394

9495
- name: Test
9596
if: matrix.host != 'x86_64-unknown-linux-gnu'
96-
run: cargo test --features deny-warnings,internal -- --skip dogfood
97+
run: cargo test --features internal -- --skip dogfood
9798

9899
- name: Test clippy_lints
99-
run: cargo test --features deny-warnings,internal
100+
run: cargo test --features internal
100101
working-directory: clippy_lints
101102

102103
- name: Test clippy_utils
103-
run: cargo test --features deny-warnings
104+
run: cargo test
104105
working-directory: clippy_utils
105106

106107
- name: Test clippy_config
107-
run: cargo test --features deny-warnings
108+
run: cargo test
108109
working-directory: clippy_config
109110

110111
- name: Test rustc_tools_util
111-
run: cargo test --features deny-warnings
112+
run: cargo test
112113
working-directory: rustc_tools_util
113114

114115
- name: Test clippy_dev
115-
run: cargo test --features deny-warnings
116+
run: cargo test
116117
working-directory: clippy_dev
117118

118119
- name: Test clippy-driver

.github/workflows/clippy_dev.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
env:
1717
RUST_BACKTRACE: 1
1818
CARGO_INCREMENTAL: 0
19+
RUSTFLAGS: -D warnings
1920

2021
jobs:
2122
clippy_dev:
@@ -28,7 +29,7 @@ jobs:
2829

2930
# Run
3031
- name: Build
31-
run: cargo build --features deny-warnings
32+
run: cargo build
3233
working-directory: clippy_dev
3334

3435
- name: Test update_lints
@@ -38,6 +39,8 @@ jobs:
3839
run: cargo dev fmt --check
3940

4041
- name: Test cargo dev new lint
42+
env:
43+
RUSTFLAGS: -A unused-imports
4144
run: |
4245
cargo dev new_lint --name new_early_pass --pass early
4346
cargo dev new_lint --name new_late_pass --pass late

.github/workflows/lintcheck.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ jobs:
5353
id: cache-json
5454
uses: actions/cache@v4
5555
with:
56-
path: lintcheck-logs/lintcheck_crates_logs.json
56+
path: lintcheck-logs/ci_crates_logs.json
5757
key: ${{ steps.key.outputs.key }}
5858

5959
- name: Run lintcheck
6060
if: steps.cache-json.outputs.cache-hit != 'true'
61-
run: ./target/debug/lintcheck --format json
61+
run: ./target/debug/lintcheck --format json --all-lints --crates-toml ./lintcheck/ci_crates.toml
6262

6363
- name: Upload base JSON
6464
uses: actions/upload-artifact@v4
6565
with:
6666
name: base
67-
path: lintcheck-logs/lintcheck_crates_logs.json
67+
path: lintcheck-logs/ci_crates_logs.json
6868

6969
# Runs lintcheck on the PR and stores the results as an artifact
7070
head:
@@ -86,13 +86,13 @@ jobs:
8686
run: cargo build --manifest-path=lintcheck/Cargo.toml
8787

8888
- name: Run lintcheck
89-
run: ./target/debug/lintcheck --format json
89+
run: ./target/debug/lintcheck --format json --all-lints --crates-toml ./lintcheck/ci_crates.toml
9090

9191
- name: Upload head JSON
9292
uses: actions/upload-artifact@v4
9393
with:
9494
name: head
95-
path: lintcheck-logs/lintcheck_crates_logs.json
95+
path: lintcheck-logs/ci_crates_logs.json
9696

9797
# Retrieves the head and base JSON results and prints the diff to the GH actions step summary
9898
diff:
@@ -115,4 +115,20 @@ jobs:
115115
uses: actions/download-artifact@v4
116116

117117
- name: Diff results
118-
run: ./target/debug/lintcheck diff {base,head}/lintcheck_crates_logs.json >> $GITHUB_STEP_SUMMARY
118+
# GH's summery has a maximum size of 1024k:
119+
# https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary
120+
# That's why we first log to file and then to the summary and logs
121+
run: |
122+
./target/debug/lintcheck diff {base,head}/ci_crates_logs.json --truncate >> truncated_diff.md
123+
head -c 1024000 truncated_diff.md >> $GITHUB_STEP_SUMMARY
124+
cat truncated_diff.md
125+
./target/debug/lintcheck diff {base,head}/ci_crates_logs.json >> full_diff.md
126+
127+
- name: Upload full diff
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: diff
131+
if-no-files-found: ignore
132+
path: |
133+
full_diff.md
134+
truncated_diff.md

CHANGELOG.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,53 @@ document.
66

77
## Unreleased / Beta / In Rust Nightly
88

9-
[ca3b3937...master](https://github.com/rust-lang/rust-clippy/compare/ca3b3937...master)
9+
[c9139bd5...master](https://github.com/rust-lang/rust-clippy/compare/c9139bd5...master)
10+
11+
## Rust 1.80
12+
13+
Current stable, released 2024-07-25
14+
15+
[View all 68 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-04-18T22%3A50%3A22Z..2024-05-30T08%3A26%3A18Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
* Added [`while_float`] to `nursery`
20+
[#12765](https://github.com/rust-lang/rust-clippy/pull/12765)
21+
* Added [`macro_metavars_in_unsafe`] to `suspicious`
22+
[#12107](https://github.com/rust-lang/rust-clippy/pull/12107)
23+
* Added [`renamed_function_params`] to `restriction`
24+
[#11540](https://github.com/rust-lang/rust-clippy/pull/11540)
25+
* Added [`doc_lazy_continuation`] to `style`
26+
[#12770](https://github.com/rust-lang/rust-clippy/pull/12770)
27+
28+
### Moves and Deprecations
29+
30+
* Moved [`assigning_clones`] to `pedantic` (From `perf` now allow-by-default)
31+
[#12779](https://github.com/rust-lang/rust-clippy/pull/12779)
32+
* Moved [`single_char_pattern`] to `pedantic` (From `perf` now allow-by-default)
33+
[#11852](https://github.com/rust-lang/rust-clippy/pull/11852)
34+
35+
### Enhancements
36+
37+
* [`panic`]: Added [`allow-panic-in-tests`] configuration to allow the lint in tests
38+
[#12803](https://github.com/rust-lang/rust-clippy/pull/12803)
39+
* [`missing_const_for_fn`]: Now respects the [`msrv`] configuration
40+
[#12713](https://github.com/rust-lang/rust-clippy/pull/12713)
41+
* [`missing_panics_doc`]: No longer lints on compile-time panics
42+
[#12790](https://github.com/rust-lang/rust-clippy/pull/12790)
43+
* [`collapsible_match`]: Now considers the [`msrv`] configuration for the suggestion
44+
[#12745](https://github.com/rust-lang/rust-clippy/pull/12745)
45+
* [`useless_vec`]: Added [`allow-useless-vec-in-tests`] configuration to allow the lint in tests
46+
[#12725](https://github.com/rust-lang/rust-clippy/pull/12725)
47+
48+
### Suggestion Fixes/Improvements
49+
50+
* [`single_match`], [`single_match_else`]: Suggestions are now machine-applicable
51+
[#12726](https://github.com/rust-lang/rust-clippy/pull/12726)
1052

1153
## Rust 1.79
1254

13-
Current stable, released 2024-06-13
55+
Released 2024-06-13
1456

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

@@ -5236,6 +5278,7 @@ Released 2018-09-13
52365278
[`boxed_local`]: https://rust-lang.github.io/rust-clippy/master/index.html#boxed_local
52375279
[`branches_sharing_code`]: https://rust-lang.github.io/rust-clippy/master/index.html#branches_sharing_code
52385280
[`builtin_type_shadow`]: https://rust-lang.github.io/rust-clippy/master/index.html#builtin_type_shadow
5281+
[`byte_char_slices`]: https://rust-lang.github.io/rust-clippy/master/index.html#byte_char_slices
52395282
[`bytes_count_to_len`]: https://rust-lang.github.io/rust-clippy/master/index.html#bytes_count_to_len
52405283
[`bytes_nth`]: https://rust-lang.github.io/rust-clippy/master/index.html#bytes_nth
52415284
[`cargo_common_metadata`]: https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata
@@ -5253,6 +5296,7 @@ Released 2018-09-13
52535296
[`cast_sign_loss`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
52545297
[`cast_slice_different_sizes`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_different_sizes
52555298
[`cast_slice_from_raw_parts`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_from_raw_parts
5299+
[`cfg_not_test`]: https://rust-lang.github.io/rust-clippy/master/index.html#cfg_not_test
52565300
[`char_lit_as_u8`]: https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8
52575301
[`chars_last_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp
52585302
[`chars_next_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_next_cmp
@@ -5589,6 +5633,7 @@ Released 2018-09-13
55895633
[`missing_assert_message`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_assert_message
55905634
[`missing_asserts_for_indexing`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_asserts_for_indexing
55915635
[`missing_const_for_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
5636+
[`missing_const_for_thread_local`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_thread_local
55925637
[`missing_docs_in_private_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_docs_in_private_items
55935638
[`missing_enforced_import_renames`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_enforced_import_renames
55945639
[`missing_errors_doc`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
@@ -5703,12 +5748,14 @@ Released 2018-09-13
57035748
[`panic`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic
57045749
[`panic_in_result_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic_in_result_fn
57055750
[`panic_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic_params
5751+
[`panicking_overflow_checks`]: https://rust-lang.github.io/rust-clippy/master/index.html#panicking_overflow_checks
57065752
[`panicking_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#panicking_unwrap
57075753
[`partial_pub_fields`]: https://rust-lang.github.io/rust-clippy/master/index.html#partial_pub_fields
57085754
[`partialeq_ne_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_ne_impl
57095755
[`partialeq_to_none`]: https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_to_none
57105756
[`path_buf_push_overwrite`]: https://rust-lang.github.io/rust-clippy/master/index.html#path_buf_push_overwrite
57115757
[`path_ends_with_ext`]: https://rust-lang.github.io/rust-clippy/master/index.html#path_ends_with_ext
5758+
[`pathbuf_init_then_push`]: https://rust-lang.github.io/rust-clippy/master/index.html#pathbuf_init_then_push
57125759
[`pattern_type_mismatch`]: https://rust-lang.github.io/rust-clippy/master/index.html#pattern_type_mismatch
57135760
[`permissions_set_readonly_false`]: https://rust-lang.github.io/rust-clippy/master/index.html#permissions_set_readonly_false
57145761
[`positional_named_format_parameters`]: https://rust-lang.github.io/rust-clippy/master/index.html#positional_named_format_parameters
@@ -5784,6 +5831,7 @@ Released 2018-09-13
57845831
[`result_unit_err`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_unit_err
57855832
[`result_unwrap_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_unwrap_used
57865833
[`return_self_not_must_use`]: https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
5834+
[`reverse_range_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#reverse_range_loop
57875835
[`reversed_empty_ranges`]: https://rust-lang.github.io/rust-clippy/master/index.html#reversed_empty_ranges
57885836
[`same_functions_in_if_condition`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_functions_in_if_condition
57895837
[`same_item_push`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push
@@ -5952,6 +6000,7 @@ Released 2018-09-13
59526000
[`unused_io_amount`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_io_amount
59536001
[`unused_label`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_label
59546002
[`unused_peekable`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_peekable
6003+
[`unused_result_ok`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_result_ok
59556004
[`unused_rounding`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_rounding
59566005
[`unused_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
59576006
[`unused_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

Cargo.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.81"
3+
version = "0.1.82"
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"
@@ -30,11 +30,10 @@ color-print = "0.3.4"
3030
anstream = "0.6.0"
3131

3232
[dev-dependencies]
33-
ui_test = "0.23"
33+
ui_test = "0.25"
3434
regex = "1.5.5"
3535
toml = "0.7.3"
3636
walkdir = "2.3"
37-
# This is used by the `collect-metadata` alias.
3837
filetime = "0.2.9"
3938
itertools = "0.12"
4039

@@ -52,7 +51,6 @@ tokio = { version = "1", features = ["io-util"] }
5251
rustc_tools_util = "0.3.0"
5352

5453
[features]
55-
deny-warnings = ["clippy_lints/deny-warnings"]
5654
integration = ["tempfile"]
5755
internal = ["clippy_lints/internal", "tempfile"]
5856

@@ -63,3 +61,7 @@ rustc_private = true
6361
[[test]]
6462
name = "compile-test"
6563
harness = false
64+
65+
[[test]]
66+
name = "dogfood"
67+
harness = false

book/src/development/adding_lints.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,8 @@ pub struct ManualStrip {
458458
}
459459

460460
impl ManualStrip {
461-
#[must_use]
462-
pub fn new(msrv: Msrv) -> Self {
463-
Self { msrv }
461+
pub fn new(conf: &'static Conf) -> Self {
462+
Self { msrv: conf.msrv.clone() }
464463
}
465464
}
466465
```
@@ -689,7 +688,6 @@ for some users. Adding a configuration is done in the following steps:
689688
]);
690689

691690
// New manual definition struct
692-
#[derive(Copy, Clone)]
693691
pub struct StructName {}
694692

695693
impl_lint_pass!(StructName => [
@@ -700,17 +698,16 @@ for some users. Adding a configuration is done in the following steps:
700698
2. Next add the configuration value and a corresponding creation method like
701699
this:
702700
```rust
703-
#[derive(Copy, Clone)]
704701
pub struct StructName {
705702
configuration_ident: Type,
706703
}
707704

708705
// ...
709706

710707
impl StructName {
711-
pub fn new(configuration_ident: Type) -> Self {
708+
pub fn new(conf: &'static Conf) -> Self {
712709
Self {
713-
configuration_ident,
710+
configuration_ident: conf.configuration_ident,
714711
}
715712
}
716713
}
@@ -726,8 +723,7 @@ for some users. Adding a configuration is done in the following steps:
726723
store.register_*_pass(|| box module::StructName);
727724

728725
// New registration with configuration value
729-
let configuration_ident = conf.configuration_ident.clone();
730-
store.register_*_pass(move || box module::StructName::new(configuration_ident));
726+
store.register_*_pass(move || box module::StructName::new(conf));
731727
```
732728

733729
Congratulations the work is almost done. The configuration value can now be

0 commit comments

Comments
 (0)