Skip to content

Commit fcc17bd

Browse files
committed
Merge main
2 parents ebb490f + c642d0c commit fcc17bd

File tree

642 files changed

+9164
-3642
lines changed

Some content is hidden

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

642 files changed

+9164
-3642
lines changed

.github/workflows/clippy.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@ env:
2626
NO_FMT_TEST: 1
2727
CARGO_INCREMENTAL: 0
2828

29+
concurrency:
30+
# For a given workflow, if we push to the same PR, cancel all previous builds on that PR.
31+
# If the push is not attached to a PR, we will cancel all builds on the same branch.
32+
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
33+
cancel-in-progress: true
34+
2935
jobs:
3036
base:
3137
# NOTE: If you modify this job, make sure you copy the changes to clippy_bors.yml
3238
runs-on: ubuntu-latest
3339

3440
steps:
3541
# Setup
36-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
37-
with:
38-
github_token: "${{ secrets.github_token }}"
39-
4042
- name: Checkout
4143
uses: actions/checkout@v4
4244

.github/workflows/clippy_bors.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ env:
1212
NO_FMT_TEST: 1
1313
CARGO_INCREMENTAL: 0
1414

15+
concurrency:
16+
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch.
17+
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
18+
cancel-in-progress: true
19+
1520
defaults:
1621
run:
1722
shell: bash
@@ -21,10 +26,6 @@ jobs:
2126
runs-on: ubuntu-latest
2227

2328
steps:
24-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
25-
with:
26-
github_token: "${{ secrets.github_token }}"
27-
2829
- name: Checkout
2930
uses: actions/checkout@v4
3031
with:
@@ -67,10 +68,6 @@ jobs:
6768
# NOTE: If you modify this job, make sure you copy the changes to clippy.yml
6869
steps:
6970
# Setup
70-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
71-
with:
72-
github_token: "${{ secrets.github_token }}"
73-
7471
- name: Checkout
7572
uses: actions/checkout@v4
7673

@@ -131,10 +128,6 @@ jobs:
131128

132129
steps:
133130
# Setup
134-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
135-
with:
136-
github_token: "${{ secrets.github_token }}"
137-
138131
- name: Checkout
139132
uses: actions/checkout@v4
140133

@@ -155,10 +148,6 @@ jobs:
155148

156149
steps:
157150
# Setup
158-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
159-
with:
160-
github_token: "${{ secrets.github_token }}"
161-
162151
- name: Checkout
163152
uses: actions/checkout@v4
164153

@@ -211,10 +200,6 @@ jobs:
211200

212201
steps:
213202
# Setup
214-
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
215-
with:
216-
github_token: "${{ secrets.github_token }}"
217-
218203
- name: Checkout
219204
uses: actions/checkout@v4
220205

.github/workflows/remark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
node-version: '18.x'
2525

2626
- name: Install remark
27-
run: npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended remark-gfm
27+
run: npm install remark-cli remark-lint remark-lint-maximum-line-length@^3.1.3 remark-preset-lint-recommended remark-gfm
2828

2929
- name: Install mdbook
3030
run: |

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Generated by ui-test
2+
rustc-ice-*
3+
14
# Used by CI to be able to push:
25
/.github/deploy_key
36
out

CHANGELOG.md

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

77
## Unreleased / Beta / In Rust Nightly
88

9-
[a859e5cc...master](https://github.com/rust-lang/rust-clippy/compare/a859e5cc...master)
9+
[66c29b97...master](https://github.com/rust-lang/rust-clippy/compare/66c29b97...master)
10+
11+
## Rust 1.77
12+
13+
Current stable, released 2024-03-18
14+
15+
[View all 93 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2023-12-16T18%3A20%3A00Z..2024-01-25T18%3A15%3A56Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
* [`suspicious_open_options`]
20+
[#11608](https://github.com/rust-lang/rust-clippy/pull/11608)
21+
* [`option_as_ref_cloned`]
22+
[#12051](https://github.com/rust-lang/rust-clippy/pull/12051)
23+
* [`thread_local_initializer_can_be_made_const`]
24+
[#12026](https://github.com/rust-lang/rust-clippy/pull/12026)
25+
* [`str_split_at_newline`]
26+
[#11987](https://github.com/rust-lang/rust-clippy/pull/11987)
27+
* [`empty_enum_variants_with_brackets`]
28+
[#12047](https://github.com/rust-lang/rust-clippy/pull/12047)
29+
* [`manual_is_variant_and`]
30+
[#11865](https://github.com/rust-lang/rust-clippy/pull/11865)
31+
* [`pub_underscore_fields`]
32+
[#10283](https://github.com/rust-lang/rust-clippy/pull/10283)
33+
* [`eager_transmute`]
34+
[#11981](https://github.com/rust-lang/rust-clippy/pull/11981)
35+
* [`iter_filter_is_some`]
36+
[#12004](https://github.com/rust-lang/rust/pull/12004)
37+
* [`iter_filter_is_ok`]
38+
[#12004](https://github.com/rust-lang/rust/pull/12004)
39+
* [`result_filter_map`]
40+
[#11869](https://github.com/rust-lang/rust-clippy/pull/11869)
41+
* [`unconditional_recursion`]
42+
[#11938](https://github.com/rust-lang/rust-clippy/pull/11938)
43+
44+
### Enhancements
45+
46+
* [`multiple_crate_versions`]: Added the [`allowed-duplicate-crates`] configuration to allow specific crates
47+
[#12179](https://github.com/rust-lang/rust-clippy/pull/12179)
48+
* [`single_call_fn`]: No longer ignores `#[allow]` attributes
49+
[#12183](https://github.com/rust-lang/rust-clippy/pull/12183)
50+
* [`read_zero_byte_vec`]: Updated the heuristics used for linting
51+
[#11766](https://github.com/rust-lang/rust-clippy/pull/11766)
52+
53+
### ICE Fixes
54+
55+
* [`unit_arg`]: No longer crashes when checking for const in nested bodies
56+
[#11977](https://github.com/rust-lang/rust-clippy/pull/11977)
57+
* [`indexing_slicing`]: No longer crashes when the array index exceeds `usize`
58+
[#12266](https://github.com/rust-lang/rust-clippy/pull/12266)
59+
60+
### Others
61+
62+
* Warnings about invalid fields inside `clippy.toml` files now include suggestions for existing fields
63+
[#12180](https://github.com/rust-lang/rust-clippy/pull/12180)
1064

1165
## Rust 1.76
1266

13-
Current stable, released 2024-02-08
67+
Released 2024-02-08
1468

1569
[View all 85 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2023-11-02T20%3A23%3A40Z..2023-12-16T13%3A11%3A08Z+base%3Amaster)
1670

@@ -5281,6 +5335,7 @@ Released 2018-09-13
52815335
[`int_plus_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#int_plus_one
52825336
[`integer_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#integer_arithmetic
52835337
[`integer_division`]: https://rust-lang.github.io/rust-clippy/master/index.html#integer_division
5338+
[`integer_division_remainder_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#integer_division_remainder_used
52845339
[`into_iter_on_array`]: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_array
52855340
[`into_iter_on_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
52865341
[`into_iter_without_iter`]: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_without_iter
@@ -5324,6 +5379,7 @@ Released 2018-09-13
53245379
[`large_stack_arrays`]: https://rust-lang.github.io/rust-clippy/master/index.html#large_stack_arrays
53255380
[`large_stack_frames`]: https://rust-lang.github.io/rust-clippy/master/index.html#large_stack_frames
53265381
[`large_types_passed_by_value`]: https://rust-lang.github.io/rust-clippy/master/index.html#large_types_passed_by_value
5382+
[`legacy_numeric_constants`]: https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants
53275383
[`len_without_is_empty`]: https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
53285384
[`len_zero`]: https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
53295385
[`let_and_return`]: https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
@@ -5426,6 +5482,7 @@ Released 2018-09-13
54265482
[`missing_safety_doc`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
54275483
[`missing_spin_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_spin_loop
54285484
[`missing_trait_methods`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_trait_methods
5485+
[`missing_transmute_annotations`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations
54295486
[`mistyped_literal_suffixes`]: https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
54305487
[`mixed_attributes_style`]: https://rust-lang.github.io/rust-clippy/master/index.html#mixed_attributes_style
54315488
[`mixed_case_hex_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#mixed_case_hex_literals
@@ -5837,6 +5894,7 @@ Released 2018-09-13
58375894
[`allowed-dotfiles`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-dotfiles
58385895
[`allowed-duplicate-crates`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-duplicate-crates
58395896
[`allowed-idents-below-min-chars`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-idents-below-min-chars
5897+
[`allowed-prefixes`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-prefixes
58405898
[`allowed-scripts`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-scripts
58415899
[`allowed-wildcard-imports`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-wildcard-imports
58425900
[`arithmetic-side-effects-allowed`]: https://doc.rust-lang.org/clippy/lint_configuration.html#arithmetic-side-effects-allowed

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.78"
3+
version = "0.1.79"
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"
@@ -31,12 +31,11 @@ anstream = "0.6.0"
3131

3232
[dev-dependencies]
3333
ui_test = "0.22.2"
34-
tester = "0.9"
3534
regex = "1.5.5"
3635
toml = "0.7.3"
3736
walkdir = "2.3"
3837
# This is used by the `collect-metadata` alias.
39-
filetime = "0.2"
38+
filetime = "0.2.9"
4039
itertools = "0.12"
4140

4241
# UI test dependencies

book/src/README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,27 @@ category.
1818
| `clippy::all` | all lints that are on by default (correctness, suspicious, style, complexity, perf) | **warn/deny** |
1919
| `clippy::correctness` | code that is outright wrong or useless | **deny** |
2020
| `clippy::suspicious` | code that is most likely wrong or useless | **warn** |
21+
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
2122
| `clippy::complexity` | code that does something simple but in a complex way | **warn** |
2223
| `clippy::perf` | code that can be written to run faster | **warn** |
23-
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
24-
| `clippy::pedantic` | lints which are rather strict or might have false positives | allow |
24+
| `clippy::pedantic` | lints which are rather strict or have occasional false positives | allow |
25+
| `clippy::restriction` | lints which prevent the use of language and library features[^restrict] | allow |
2526
| `clippy::nursery` | new lints that are still under development | allow |
26-
| `clippy::cargo` | lints for the cargo manifest | allow | | allow |
27+
| `clippy::cargo` | lints for the cargo manifest | allow |
28+
29+
More to come, please [file an issue](https://github.com/rust-lang/rust-clippy/issues) if you have ideas!
30+
31+
The `restriction` category should, *emphatically*, not be enabled as a whole. The contained
32+
lints may lint against perfectly reasonable code, may not have an alternative suggestion,
33+
and may contradict any other lints (including other categories). Lints should be considered
34+
on a case-by-case basis before enabling.
2735

28-
More to come, please [file an
29-
issue](https://github.com/rust-lang/rust-clippy/issues) if you have ideas!
36+
[^restrict]: Some use cases for `restriction` lints include:
37+
- Strict coding styles (e.g. [`clippy::else_if_without_else`]).
38+
- Additional restrictions on CI (e.g. [`clippy::todo`]).
39+
- Preventing panicking in certain functions (e.g. [`clippy::unwrap_used`]).
40+
- Running a lint only on a subset of code (e.g. `#[forbid(clippy::float_arithmetic)]` on a module).
3041

31-
The [lint list](https://rust-lang.github.io/rust-clippy/master/index.html) also
32-
contains "restriction lints", which are for things which are usually not
33-
considered "bad", but may be useful to turn on in specific cases. These should
34-
be used very selectively, if at all.
42+
[`clippy::else_if_without_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#else_if_without_else
43+
[`clippy::todo`]: https://rust-lang.github.io/rust-clippy/master/index.html#todo
44+
[`clippy::unwrap_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used

book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@
3232
- [Proposals](development/proposals/README.md)
3333
- [Roadmap 2021](development/proposals/roadmap-2021.md)
3434
- [Syntax Tree Patterns](development/proposals/syntax-tree-patterns.md)
35+
- [The Team](development/the_team.md)

book/src/development/adding_lints.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ because that's clearly a non-descriptive name.
1818
- [Cargo lints](#cargo-lints)
1919
- [Rustfix tests](#rustfix-tests)
2020
- [Testing manually](#testing-manually)
21-
- [Running directly](#running-directly)
2221
- [Lint declaration](#lint-declaration)
2322
- [Lint registration](#lint-registration)
2423
- [Lint passes](#lint-passes)
@@ -176,23 +175,26 @@ the tests.
176175

177176
Manually testing against an example file can be useful if you have added some
178177
`println!`s and the test suite output becomes unreadable. To try Clippy with
179-
your local modifications, run
178+
your local modifications, run the following from the Clippy directory:
180179

181-
```
180+
```bash
182181
cargo dev lint input.rs
183182
```
184183

185-
from the working copy root. With tests in place, let's have a look at
186-
implementing our lint now.
184+
To run Clippy on an existing project rather than a single file you can use
185+
186+
```bash
187+
cargo dev lint /path/to/project
188+
```
189+
190+
Or set up a rustup toolchain that points to the local Clippy binaries
187191

188-
## Running directly
192+
```bash
193+
cargo dev setup toolchain
189194

190-
While it's easier to just use `cargo dev lint`, it might be desirable to get
191-
`target/release/cargo-clippy` and `target/release/clippy-driver` to work as well in some cases.
192-
By default, they don't work because clippy dynamically links rustc. To help them find rustc,
193-
add the path printed by`rustc --print target-libdir` (ran inside this workspace so that the rustc version matches)
194-
to your library search path.
195-
On linux, this can be done by setting the `LD_LIBRARY_PATH` environment variable to that path.
195+
# Then in `/path/to/project` you can run
196+
cargo +clippy clippy
197+
```
196198

197199
## Lint declaration
198200

book/src/development/defining_lints.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ $ cargo dev new_lint --name=lint_name --pass=late --category=pedantic
6262
There are two things to note here:
6363

6464
1. `--pass`: We set `--pass=late` in this command to do a late lint pass. The
65-
alternative is an `early` lint pass. We will discuss this difference in a
66-
later chapter.
67-
<!-- FIXME: Link that "later chapter" when lint_passes.md is merged -->
65+
alternative is an `early` lint pass. We will discuss this difference in the
66+
[Lint Passes] chapter.
6867
2. `--category`: If not provided, the `category` of this new lint will default
6968
to `nursery`.
7069

@@ -194,12 +193,12 @@ store.register_late_pass(|_| Box::new(foo_functions::FooFunctions));
194193

195194
As you might have guessed, where there's something late, there is something
196195
early: in Clippy there is a `register_early_pass` method as well. More on early
197-
vs. late passes in a later chapter.
198-
<!-- FIXME: Link that "later chapter" when lint_passes.md is merged -->
196+
vs. late passes in the [Lint Passes] chapter.
199197

200198
Without a call to one of `register_early_pass` or `register_late_pass`, the lint
201199
pass in question will not be run.
202200

203201

204202
[all_lints]: https://rust-lang.github.io/rust-clippy/master/
205203
[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
204+
[Lint Passes]: lint_passes.md

0 commit comments

Comments
 (0)