Skip to content

Commit f77be84

Browse files
authored
Rollup merge of #84001 - flip1995:clippyup, r=Manishearth
Update Clippy Biweekly Clippy update r? ``@Manishearth``
2 parents 901ada6 + 6b37cd3 commit f77be84

File tree

349 files changed

+10307
-5900
lines changed

Some content is hidden

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

349 files changed

+10307
-5900
lines changed

src/tools/clippy/CHANGELOG.md

+143-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,146 @@ document.
66

77
## Unreleased / In Rust Nightly
88

9-
[3e41797...master](https://github.com/rust-lang/rust-clippy/compare/3e41797...master)
9+
[6ed6f1e...master](https://github.com/rust-lang/rust-clippy/compare/6ed6f1e...master)
10+
11+
## Rust 1.52
12+
13+
Current beta, release 2021-05-06
14+
15+
[3e41797...6ed6f1e](https://github.com/rust-lang/rust-clippy/compare/3e41797...6ed6f1e)
16+
17+
### New Lints
18+
19+
* [`from_str_radix_10`]
20+
[#6717](https://github.com/rust-lang/rust-clippy/pull/6717)
21+
* [`implicit_clone`]
22+
[#6730](https://github.com/rust-lang/rust-clippy/pull/6730)
23+
* [`semicolon_if_nothing_returned`]
24+
[#6681](https://github.com/rust-lang/rust-clippy/pull/6681)
25+
* [`manual_flatten`]
26+
[#6646](https://github.com/rust-lang/rust-clippy/pull/6646)
27+
* [`inconsistent_struct_constructor`]
28+
[#6769](https://github.com/rust-lang/rust-clippy/pull/6769)
29+
* [`iter_count`]
30+
[#6791](https://github.com/rust-lang/rust-clippy/pull/6791)
31+
* [`default_numeric_fallback`]
32+
[#6662](https://github.com/rust-lang/rust-clippy/pull/6662)
33+
* [`bytes_nth`]
34+
[#6695](https://github.com/rust-lang/rust-clippy/pull/6695)
35+
* [`filter_map_identity`]
36+
[#6685](https://github.com/rust-lang/rust-clippy/pull/6685)
37+
* [`manual_map`]
38+
[#6573](https://github.com/rust-lang/rust-clippy/pull/6573)
39+
40+
### Moves and Deprecations
41+
42+
* Moved [`upper_case_acronyms`] to `pedantic`
43+
[#6775](https://github.com/rust-lang/rust-clippy/pull/6775)
44+
* Moved [`manual_map`] to `nursery`
45+
[#6796](https://github.com/rust-lang/rust-clippy/pull/6796)
46+
* Moved [`unnecessary_wraps`] to `pedantic`
47+
[#6765](https://github.com/rust-lang/rust-clippy/pull/6765)
48+
* Moved [`trivial_regex`] to `nursery`
49+
[#6696](https://github.com/rust-lang/rust-clippy/pull/6696)
50+
* Moved [`naive_bytecount`] to `pedantic`
51+
[#6825](https://github.com/rust-lang/rust-clippy/pull/6825)
52+
* Moved [`upper_case_acronyms`] to `style`
53+
[#6788](https://github.com/rust-lang/rust-clippy/pull/6788)
54+
* Moved [`manual_map`] to `style`
55+
[#6801](https://github.com/rust-lang/rust-clippy/pull/6801)
56+
57+
### Enhancements
58+
59+
* [`disallowed_method`]: Now supports functions in addition to methods
60+
[#6674](https://github.com/rust-lang/rust-clippy/pull/6674)
61+
* [`upper_case_acronyms`]: Added a new configuration `upper-case-acronyms-aggressive` to
62+
trigger the lint if there is more than one uppercase character next to each other
63+
[#6788](https://github.com/rust-lang/rust-clippy/pull/6788)
64+
* [`collapsible_match`]: Now supports block comparison with different value names
65+
[#6754](https://github.com/rust-lang/rust-clippy/pull/6754)
66+
* [`unnecessary_wraps`]: Will now suggest removing unnecessary wrapped return unit type, like `Option<()>`
67+
[#6665](https://github.com/rust-lang/rust-clippy/pull/6665)
68+
* Improved value usage detection in closures
69+
[#6698](https://github.com/rust-lang/rust-clippy/pull/6698)
70+
71+
### False Positive Fixes
72+
73+
* [`use_self`]: No longer lints in macros
74+
[#6833](https://github.com/rust-lang/rust-clippy/pull/6833)
75+
* [`use_self`]: Fixed multiple false positives for: generics, associated types and derive implementations
76+
[#6179](https://github.com/rust-lang/rust-clippy/pull/6179)
77+
* [`missing_inline_in_public_items`]: No longer lints for procedural macros
78+
[#6814](https://github.com/rust-lang/rust-clippy/pull/6814)
79+
* [`inherent_to_string`]: No longer lints on functions with function generics
80+
[#6771](https://github.com/rust-lang/rust-clippy/pull/6771)
81+
* [`doc_markdown`]: Add `OpenDNS` to the default configuration as an allowed identifier
82+
[#6783](https://github.com/rust-lang/rust-clippy/pull/6783)
83+
* [`missing_panics_doc`]: No longer lints on [`unreachable!`](https://doc.rust-lang.org/std/macro.unreachable.html)
84+
[#6700](https://github.com/rust-lang/rust-clippy/pull/6700)
85+
* [`collapsible_if`]: No longer lints on if statements with attributes
86+
[#6701](https://github.com/rust-lang/rust-clippy/pull/6701)
87+
* [`match_same_arms`]: Only considers empty blocks as equal if the tokens contained are the same
88+
[#6843](https://github.com/rust-lang/rust-clippy/pull/6843)
89+
* [`redundant_closure`]: Now ignores macros
90+
[#6871](https://github.com/rust-lang/rust-clippy/pull/6871)
91+
* [`manual_map`]: Fixed false positives when control flow statements like `return`, `break` etc. are used
92+
[#6801](https://github.com/rust-lang/rust-clippy/pull/6801)
93+
* [`vec_init_then_push`]: Fixed false positives for loops and if statements
94+
[#6697](https://github.com/rust-lang/rust-clippy/pull/6697)
95+
* [`len_without_is_empty`]: Will now consider multiple impl blocks and `#[allow]` on
96+
the `len` method as well as the type definition.
97+
[#6853](https://github.com/rust-lang/rust-clippy/pull/6853)
98+
* [`let_underscore_drop`]: Only lints on types which implement `Drop`
99+
[#6682](https://github.com/rust-lang/rust-clippy/pull/6682)
100+
* [`unit_arg`]: No longer lints on unit arguments when they come from a path expression.
101+
[#6601](https://github.com/rust-lang/rust-clippy/pull/6601)
102+
* [`cargo_common_metadata`]: No longer lints if
103+
[`publish = false`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field)
104+
is defined in the manifest
105+
[#6650](https://github.com/rust-lang/rust-clippy/pull/6650)
106+
107+
### Suggestion Fixes/Improvements
108+
109+
* [`collapsible_match`]: Fixed lint message capitalization
110+
[#6766](https://github.com/rust-lang/rust-clippy/pull/6766)
111+
* [`or_fun_call`]: Improved suggestions for `or_insert(vec![])`
112+
[#6790](https://github.com/rust-lang/rust-clippy/pull/6790)
113+
* [`manual_map`]: No longer expands macros in the suggestions
114+
[#6801](https://github.com/rust-lang/rust-clippy/pull/6801)
115+
* Aligned Clippy's lint messages with the rustc dev guide
116+
[#6787](https://github.com/rust-lang/rust-clippy/pull/6787)
117+
118+
### ICE Fixes
119+
120+
* [`zero_sized_map_values`]
121+
[#6866](https://github.com/rust-lang/rust-clippy/pull/6866)
122+
123+
### Documentation Improvements
124+
125+
* [`useless_format`]: Improved the documentation example
126+
[#6854](https://github.com/rust-lang/rust-clippy/pull/6854)
127+
* Clippy's [`README.md`]: Includes a new subsection on running Clippy as a rustc wrapper
128+
[#6782](https://github.com/rust-lang/rust-clippy/pull/6782)
129+
130+
### Others
131+
* Running `cargo clippy` after `cargo check` now works as expected
132+
(`cargo clippy` and `cargo check` no longer shares the same build cache)
133+
[#6687](https://github.com/rust-lang/rust-clippy/pull/6687)
134+
* Cargo now re-runs Clippy if arguments after `--` provided to `cargo clippy` are changed.
135+
[#6834](https://github.com/rust-lang/rust-clippy/pull/6834)
136+
* Extracted Clippy's `utils` module into the new `clippy_utils` crate
137+
[#6756](https://github.com/rust-lang/rust-clippy/pull/6756)
138+
* Clippy lintcheck tool improvements
139+
[#6800](https://github.com/rust-lang/rust-clippy/pull/6800)
140+
[#6735](https://github.com/rust-lang/rust-clippy/pull/6735)
141+
[#6764](https://github.com/rust-lang/rust-clippy/pull/6764)
142+
[#6708](https://github.com/rust-lang/rust-clippy/pull/6708)
143+
[#6780](https://github.com/rust-lang/rust-clippy/pull/6780)
144+
[#6686](https://github.com/rust-lang/rust-clippy/pull/6686)
10145

11146
## Rust 1.51
12147

13-
Current beta, release 2021-03-25
148+
Current stable, released 2021-03-25
14149

15150
[4911ab1...3e41797](https://github.com/rust-lang/rust-clippy/compare/4911ab1...3e41797)
16151

@@ -125,7 +260,7 @@ Current beta, release 2021-03-25
125260

126261
## Rust 1.50
127262

128-
Current stable, released 2021-02-11
263+
Released 2021-02-11
129264

130265
[b20d4c1...4bd77a1](https://github.com/rust-lang/rust-clippy/compare/b20d4c1...4bd77a1)
131266

@@ -1970,6 +2105,7 @@ Released 2018-09-13
19702105
[configuration file]: ./rust-clippy#configuration
19712106
[pull3665]: https://github.com/rust-lang/rust-clippy/pull/3665
19722107
[adding_lints]: https://github.com/rust-lang/rust-clippy/blob/master/doc/adding_lints.md
2108+
[`README.md`]: https://github.com/rust-lang/rust-clippy/blob/master/README.md
19732109

19742110
<!-- lint disable no-unused-definitions -->
19752111
<!-- begin autogenerated links to lint list -->
@@ -1993,6 +2129,7 @@ Released 2018-09-13
19932129
[`borrowed_box`]: https://rust-lang.github.io/rust-clippy/master/index.html#borrowed_box
19942130
[`box_vec`]: https://rust-lang.github.io/rust-clippy/master/index.html#box_vec
19952131
[`boxed_local`]: https://rust-lang.github.io/rust-clippy/master/index.html#boxed_local
2132+
[`branches_sharing_code`]: https://rust-lang.github.io/rust-clippy/master/index.html#branches_sharing_code
19962133
[`builtin_type_shadow`]: https://rust-lang.github.io/rust-clippy/master/index.html#builtin_type_shadow
19972134
[`bytes_nth`]: https://rust-lang.github.io/rust-clippy/master/index.html#bytes_nth
19982135
[`cargo_common_metadata`]: https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata
@@ -2233,6 +2370,7 @@ Released 2018-09-13
22332370
[`needless_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect
22342371
[`needless_continue`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_continue
22352372
[`needless_doctest_main`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main
2373+
[`needless_for_each`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_for_each
22362374
[`needless_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
22372375
[`needless_pass_by_value`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
22382376
[`needless_question_mark`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
@@ -2246,13 +2384,15 @@ Released 2018-09-13
22462384
[`new_without_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
22472385
[`no_effect`]: https://rust-lang.github.io/rust-clippy/master/index.html#no_effect
22482386
[`non_ascii_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#non_ascii_literal
2387+
[`non_octal_unix_permissions`]: https://rust-lang.github.io/rust-clippy/master/index.html#non_octal_unix_permissions
22492388
[`nonminimal_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
22502389
[`nonsensical_open_options`]: https://rust-lang.github.io/rust-clippy/master/index.html#nonsensical_open_options
22512390
[`not_unsafe_ptr_arg_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
22522391
[`ok_expect`]: https://rust-lang.github.io/rust-clippy/master/index.html#ok_expect
22532392
[`op_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
22542393
[`option_as_ref_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_as_ref_deref
22552394
[`option_env_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_env_unwrap
2395+
[`option_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_filter_map
22562396
[`option_if_let_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
22572397
[`option_map_or_none`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_map_or_none
22582398
[`option_map_unit_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn

src/tools/clippy/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
77

8-
[There are over 400 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
8+
[There are over 450 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
99

1010
Lints are divided into categories, each with a default [lint level](https://doc.rust-lang.org/rustc/lints/levels.html).
1111
You can choose how much Clippy is supposed to ~~annoy~~ help you by changing the lint level by category.

src/tools/clippy/clippy_dev/src/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub fn run(check: bool, verbose: bool) {
6868
continue;
6969
}
7070

71-
success &= rustfmt(context, &path)?;
71+
success &= rustfmt(context, path)?;
7272
}
7373

7474
Ok(success)

src/tools/clippy/clippy_dev/src/lib.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl Lint {
101101
#[must_use]
102102
pub fn gen_lint_group_list<'a>(lints: impl Iterator<Item = &'a Lint>) -> Vec<String> {
103103
lints
104-
.map(|l| format!(" LintId::of(&{}::{}),", l.module, l.name.to_uppercase()))
104+
.map(|l| format!(" LintId::of({}::{}),", l.module, l.name.to_uppercase()))
105105
.sorted()
106106
.collect::<Vec<String>>()
107107
}
@@ -154,17 +154,17 @@ pub fn gen_register_lint_list<'a>(
154154
let header = " store.register_lints(&[".to_string();
155155
let footer = " ]);".to_string();
156156
let internal_lints = internal_lints
157-
.sorted_by_key(|l| format!(" &{}::{},", l.module, l.name.to_uppercase()))
157+
.sorted_by_key(|l| format!(" {}::{},", l.module, l.name.to_uppercase()))
158158
.map(|l| {
159159
format!(
160-
" #[cfg(feature = \"internal-lints\")]\n &{}::{},",
160+
" #[cfg(feature = \"internal-lints\")]\n {}::{},",
161161
l.module,
162162
l.name.to_uppercase()
163163
)
164164
});
165165
let other_lints = usable_lints
166-
.sorted_by_key(|l| format!(" &{}::{},", l.module, l.name.to_uppercase()))
167-
.map(|l| format!(" &{}::{},", l.module, l.name.to_uppercase()))
166+
.sorted_by_key(|l| format!(" {}::{},", l.module, l.name.to_uppercase()))
167+
.map(|l| format!(" {}::{},", l.module, l.name.to_uppercase()))
168168
.sorted();
169169
let mut lint_list = vec![header];
170170
lint_list.extend(internal_lints);
@@ -550,9 +550,9 @@ fn test_gen_lint_group_list() {
550550
Lint::new("internal", "internal_style", "abc", None, "module_name"),
551551
];
552552
let expected = vec![
553-
" LintId::of(&module_name::ABC),".to_string(),
554-
" LintId::of(&module_name::INTERNAL),".to_string(),
555-
" LintId::of(&module_name::SHOULD_ASSERT_EQ),".to_string(),
553+
" LintId::of(module_name::ABC),".to_string(),
554+
" LintId::of(module_name::INTERNAL),".to_string(),
555+
" LintId::of(module_name::SHOULD_ASSERT_EQ),".to_string(),
556556
];
557557
assert_eq!(expected, gen_lint_group_list(lints.iter()));
558558
}

0 commit comments

Comments
 (0)