Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 87a2408

Browse files
committed
Auto merge of rust-lang#110003 - flip1995:clippyup, r=Manishearth
Update Clippy r? `@Manishearth`
2 parents 45749b2 + c355e6b commit 87a2408

File tree

146 files changed

+4729
-1695
lines changed

Some content is hidden

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

146 files changed

+4729
-1695
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ dependencies = [
830830
name = "clippy_lints"
831831
version = "0.1.70"
832832
dependencies = [
833+
"arrayvec 0.7.0",
833834
"cargo_metadata 0.15.3",
834835
"clippy_utils",
835836
"declare_clippy_lint",

src/tools/clippy/.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ target-dir = "target"
1111

1212
[unstable]
1313
binary-dep-depinfo = true
14+
15+
[profile.dev]
16+
split-debuginfo = "unpacked"

src/tools/clippy/.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ trim_trailing_whitespace = true
1111
insert_final_newline = true
1212
indent_style = space
1313
indent_size = 4
14+
max_line_length = 120
1415

1516
[*.md]
1617
# double whitespace at end of line

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ jobs:
180180

181181
# Run
182182
- name: Build Integration Test
183+
env:
184+
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: off
183185
run: cargo test --test integration --features integration --no-run
184186

185187
# Upload

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install mdbook
3030
run: |
3131
mkdir mdbook
32-
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.18/mdbook-v0.4.18-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
32+
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.28/mdbook-v0.4.28-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
3333
echo `pwd`/mdbook >> $GITHUB_PATH
3434
3535
# Run

src/tools/clippy/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4441,6 +4441,7 @@ Released 2018-09-13
44414441
[`chars_last_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp
44424442
[`chars_next_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_next_cmp
44434443
[`checked_conversions`]: https://rust-lang.github.io/rust-clippy/master/index.html#checked_conversions
4444+
[`clear_with_drain`]: https://rust-lang.github.io/rust-clippy/master/index.html#clear_with_drain
44444445
[`clone_double_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#clone_double_ref
44454446
[`clone_on_copy`]: https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
44464447
[`clone_on_ref_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_ref_ptr
@@ -4632,6 +4633,7 @@ Released 2018-09-13
46324633
[`large_const_arrays`]: https://rust-lang.github.io/rust-clippy/master/index.html#large_const_arrays
46334634
[`large_digit_groups`]: https://rust-lang.github.io/rust-clippy/master/index.html#large_digit_groups
46344635
[`large_enum_variant`]: https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
4636+
[`large_futures`]: https://rust-lang.github.io/rust-clippy/master/index.html#large_futures
46354637
[`large_include_file`]: https://rust-lang.github.io/rust-clippy/master/index.html#large_include_file
46364638
[`large_stack_arrays`]: https://rust-lang.github.io/rust-clippy/master/index.html#large_stack_arrays
46374639
[`large_types_passed_by_value`]: https://rust-lang.github.io/rust-clippy/master/index.html#large_types_passed_by_value
@@ -4645,6 +4647,7 @@ Released 2018-09-13
46454647
[`let_underscore_untyped`]: https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_untyped
46464648
[`let_unit_value`]: https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
46474649
[`let_with_type_underscore`]: https://rust-lang.github.io/rust-clippy/master/index.html#let_with_type_underscore
4650+
[`lines_filter_map_ok`]: https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok
46484651
[`linkedlist`]: https://rust-lang.github.io/rust-clippy/master/index.html#linkedlist
46494652
[`logic_bug`]: https://rust-lang.github.io/rust-clippy/master/index.html#logic_bug
46504653
[`lossy_float_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#lossy_float_literal
@@ -4671,6 +4674,7 @@ Released 2018-09-13
46714674
[`manual_rem_euclid`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_rem_euclid
46724675
[`manual_retain`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_retain
46734676
[`manual_saturating_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_saturating_arithmetic
4677+
[`manual_slice_size_calculation`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_slice_size_calculation
46744678
[`manual_split_once`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_split_once
46754679
[`manual_str_repeat`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_str_repeat
46764680
[`manual_string_new`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_string_new
@@ -4921,6 +4925,7 @@ Released 2018-09-13
49214925
[`suspicious_arithmetic_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_arithmetic_impl
49224926
[`suspicious_assignment_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_assignment_formatting
49234927
[`suspicious_command_arg_space`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_command_arg_space
4928+
[`suspicious_doc_comments`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_doc_comments
49244929
[`suspicious_else_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting
49254930
[`suspicious_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_map
49264931
[`suspicious_op_assign_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_op_assign_impl
@@ -4933,6 +4938,7 @@ Released 2018-09-13
49334938
[`tabs_in_doc_comments`]: https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
49344939
[`temporary_assignment`]: https://rust-lang.github.io/rust-clippy/master/index.html#temporary_assignment
49354940
[`temporary_cstring_as_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#temporary_cstring_as_ptr
4941+
[`tests_outside_test_module`]: https://rust-lang.github.io/rust-clippy/master/index.html#tests_outside_test_module
49364942
[`to_digit_is_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_digit_is_some
49374943
[`to_string_in_display`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_display
49384944
[`to_string_in_format_args`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
@@ -4974,6 +4980,7 @@ Released 2018-09-13
49744980
[`unit_hash`]: https://rust-lang.github.io/rust-clippy/master/index.html#unit_hash
49754981
[`unit_return_expecting_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#unit_return_expecting_ord
49764982
[`unknown_clippy_lints`]: https://rust-lang.github.io/rust-clippy/master/index.html#unknown_clippy_lints
4983+
[`unnecessary_box_returns`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_box_returns
49774984
[`unnecessary_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
49784985
[`unnecessary_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map
49794986
[`unnecessary_find_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_find_map

src/tools/clippy/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Lints are divided into categories, each with a default [lint level](https://doc.
1111
You can choose how much Clippy is supposed to ~~annoy~~ help you by changing the lint level by category.
1212

1313
| Category | Description | Default level |
14-
| --------------------- | ----------------------------------------------------------------------------------- | ------------- |
14+
|-----------------------|-------------------------------------------------------------------------------------|---------------|
1515
| `clippy::all` | all lints that are on by default (correctness, suspicious, style, complexity, perf) | **warn/deny** |
1616
| `clippy::correctness` | code that is outright wrong or useless | **deny** |
1717
| `clippy::suspicious` | code that is most likely wrong or useless | **warn** |
@@ -130,7 +130,7 @@ for example.
130130

131131
You can add Clippy to Travis CI in the same way you use it locally:
132132

133-
```yml
133+
```yaml
134134
language: rust
135135
rust:
136136
- stable
@@ -253,7 +253,7 @@ rust-version = "1.30"
253253

254254
The MSRV can also be specified as an attribute, like below.
255255

256-
```rust
256+
```rust,ignore
257257
#![feature(custom_inner_attributes)]
258258
#![clippy::msrv = "1.30.0"]
259259

src/tools/clippy/book/src/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ much Clippy is supposed to ~~annoy~~ help you by changing the lint level by
1414
category.
1515

1616
| Category | Description | Default level |
17-
| --------------------- | ----------------------------------------------------------------------------------- | ------------- |
17+
|-----------------------|-------------------------------------------------------------------------------------|---------------|
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** |

src/tools/clippy/book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [Development](development/README.md)
1414
- [Basics](development/basics.md)
1515
- [Adding Lints](development/adding_lints.md)
16+
- [Type Checking](development/type_checking.md)
1617
- [Common Tools](development/common_tools_writing_lints.md)
1718
- [Infrastructure](development/infrastructure/README.md)
1819
- [Syncing changes between Clippy and rust-lang/rust](development/infrastructure/sync.md)

src/tools/clippy/book/src/configuration.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> **Note:** The configuration file is unstable and may be deprecated in the future.
44
55
Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`. It contains a
6-
basic `variable = value` mapping eg.
6+
basic `variable = value` mapping e.g.
77

88
```toml
99
avoid-breaking-exported-api = false
@@ -60,7 +60,7 @@ And to warn on `lint_name`, run
6060
cargo clippy -- -W clippy::lint_name
6161
```
6262

63-
This also works with lint groups. For example you can run Clippy with warnings for all lints enabled:
63+
This also works with lint groups. For example, you can run Clippy with warnings for all lints enabled:
6464

6565
```terminal
6666
cargo clippy -- -W clippy::pedantic
@@ -84,7 +84,7 @@ msrv = "1.30.0"
8484

8585
The MSRV can also be specified as an attribute, like below.
8686

87-
```rust
87+
```rust,ignore
8888
#![feature(custom_inner_attributes)]
8989
#![clippy::msrv = "1.30.0"]
9090
@@ -96,7 +96,28 @@ fn main() {
9696
You can also omit the patch version when specifying the MSRV, so `msrv = 1.30`
9797
is equivalent to `msrv = 1.30.0`.
9898

99-
Note: `custom_inner_attributes` is an unstable feature so it has to be enabled explicitly.
99+
Note: `custom_inner_attributes` is an unstable feature, so it has to be enabled explicitly.
100100

101101
Lints that recognize this configuration option can be
102102
found [here](https://rust-lang.github.io/rust-clippy/master/index.html#msrv)
103+
104+
### Disabling evaluation of certain code
105+
106+
> **Note:** This should only be used in cases where other solutions, like `#[allow(clippy::all)]`, are not sufficient.
107+
108+
Very rarely, you may wish to prevent Clippy from evaluating certain sections of code entirely. You can do this with
109+
[conditional compilation](https://doc.rust-lang.org/reference/conditional-compilation.html) by checking that the
110+
`cargo-clippy` feature is not set. You may need to provide a stub so that the code compiles:
111+
112+
```rust
113+
#[cfg(not(feature = "cargo-clippy"))]
114+
include!(concat!(env!("OUT_DIR"), "/my_big_function-generated.rs"));
115+
116+
#[cfg(feature = "cargo-clippy")]
117+
fn my_big_function(_input: &str) -> Option<MyStruct> {
118+
None
119+
}
120+
```
121+
122+
This feature is not actually part of your crate, so specifying `--all-features` to other tools, e.g. `cargo test
123+
--all-features`, will not disable it.

0 commit comments

Comments
 (0)