Skip to content

Commit

Permalink
Rollup merge of rust-lang#84001 - flip1995:clippyup, r=Manishearth
Browse files Browse the repository at this point in the history
Update Clippy

Biweekly Clippy update

r? `@Manishearth`
  • Loading branch information
Dylan-DPC authored Apr 8, 2021
2 parents 27e52c0 + 6b37cd3 commit 7094eca
Show file tree
Hide file tree
Showing 349 changed files with 10,307 additions and 5,900 deletions.
146 changes: 143 additions & 3 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,146 @@ document.

## Unreleased / In Rust Nightly

[3e41797...master](https://github.com/rust-lang/rust-clippy/compare/3e41797...master)
[6ed6f1e...master](https://github.com/rust-lang/rust-clippy/compare/6ed6f1e...master)

## Rust 1.52

Current beta, release 2021-05-06

[3e41797...6ed6f1e](https://github.com/rust-lang/rust-clippy/compare/3e41797...6ed6f1e)

### New Lints

* [`from_str_radix_10`]
[#6717](https://github.com/rust-lang/rust-clippy/pull/6717)
* [`implicit_clone`]
[#6730](https://github.com/rust-lang/rust-clippy/pull/6730)
* [`semicolon_if_nothing_returned`]
[#6681](https://github.com/rust-lang/rust-clippy/pull/6681)
* [`manual_flatten`]
[#6646](https://github.com/rust-lang/rust-clippy/pull/6646)
* [`inconsistent_struct_constructor`]
[#6769](https://github.com/rust-lang/rust-clippy/pull/6769)
* [`iter_count`]
[#6791](https://github.com/rust-lang/rust-clippy/pull/6791)
* [`default_numeric_fallback`]
[#6662](https://github.com/rust-lang/rust-clippy/pull/6662)
* [`bytes_nth`]
[#6695](https://github.com/rust-lang/rust-clippy/pull/6695)
* [`filter_map_identity`]
[#6685](https://github.com/rust-lang/rust-clippy/pull/6685)
* [`manual_map`]
[#6573](https://github.com/rust-lang/rust-clippy/pull/6573)

### Moves and Deprecations

* Moved [`upper_case_acronyms`] to `pedantic`
[#6775](https://github.com/rust-lang/rust-clippy/pull/6775)
* Moved [`manual_map`] to `nursery`
[#6796](https://github.com/rust-lang/rust-clippy/pull/6796)
* Moved [`unnecessary_wraps`] to `pedantic`
[#6765](https://github.com/rust-lang/rust-clippy/pull/6765)
* Moved [`trivial_regex`] to `nursery`
[#6696](https://github.com/rust-lang/rust-clippy/pull/6696)
* Moved [`naive_bytecount`] to `pedantic`
[#6825](https://github.com/rust-lang/rust-clippy/pull/6825)
* Moved [`upper_case_acronyms`] to `style`
[#6788](https://github.com/rust-lang/rust-clippy/pull/6788)
* Moved [`manual_map`] to `style`
[#6801](https://github.com/rust-lang/rust-clippy/pull/6801)

### Enhancements

* [`disallowed_method`]: Now supports functions in addition to methods
[#6674](https://github.com/rust-lang/rust-clippy/pull/6674)
* [`upper_case_acronyms`]: Added a new configuration `upper-case-acronyms-aggressive` to
trigger the lint if there is more than one uppercase character next to each other
[#6788](https://github.com/rust-lang/rust-clippy/pull/6788)
* [`collapsible_match`]: Now supports block comparison with different value names
[#6754](https://github.com/rust-lang/rust-clippy/pull/6754)
* [`unnecessary_wraps`]: Will now suggest removing unnecessary wrapped return unit type, like `Option<()>`
[#6665](https://github.com/rust-lang/rust-clippy/pull/6665)
* Improved value usage detection in closures
[#6698](https://github.com/rust-lang/rust-clippy/pull/6698)

### False Positive Fixes

* [`use_self`]: No longer lints in macros
[#6833](https://github.com/rust-lang/rust-clippy/pull/6833)
* [`use_self`]: Fixed multiple false positives for: generics, associated types and derive implementations
[#6179](https://github.com/rust-lang/rust-clippy/pull/6179)
* [`missing_inline_in_public_items`]: No longer lints for procedural macros
[#6814](https://github.com/rust-lang/rust-clippy/pull/6814)
* [`inherent_to_string`]: No longer lints on functions with function generics
[#6771](https://github.com/rust-lang/rust-clippy/pull/6771)
* [`doc_markdown`]: Add `OpenDNS` to the default configuration as an allowed identifier
[#6783](https://github.com/rust-lang/rust-clippy/pull/6783)
* [`missing_panics_doc`]: No longer lints on [`unreachable!`](https://doc.rust-lang.org/std/macro.unreachable.html)
[#6700](https://github.com/rust-lang/rust-clippy/pull/6700)
* [`collapsible_if`]: No longer lints on if statements with attributes
[#6701](https://github.com/rust-lang/rust-clippy/pull/6701)
* [`match_same_arms`]: Only considers empty blocks as equal if the tokens contained are the same
[#6843](https://github.com/rust-lang/rust-clippy/pull/6843)
* [`redundant_closure`]: Now ignores macros
[#6871](https://github.com/rust-lang/rust-clippy/pull/6871)
* [`manual_map`]: Fixed false positives when control flow statements like `return`, `break` etc. are used
[#6801](https://github.com/rust-lang/rust-clippy/pull/6801)
* [`vec_init_then_push`]: Fixed false positives for loops and if statements
[#6697](https://github.com/rust-lang/rust-clippy/pull/6697)
* [`len_without_is_empty`]: Will now consider multiple impl blocks and `#[allow]` on
the `len` method as well as the type definition.
[#6853](https://github.com/rust-lang/rust-clippy/pull/6853)
* [`let_underscore_drop`]: Only lints on types which implement `Drop`
[#6682](https://github.com/rust-lang/rust-clippy/pull/6682)
* [`unit_arg`]: No longer lints on unit arguments when they come from a path expression.
[#6601](https://github.com/rust-lang/rust-clippy/pull/6601)
* [`cargo_common_metadata`]: No longer lints if
[`publish = false`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field)
is defined in the manifest
[#6650](https://github.com/rust-lang/rust-clippy/pull/6650)

### Suggestion Fixes/Improvements

* [`collapsible_match`]: Fixed lint message capitalization
[#6766](https://github.com/rust-lang/rust-clippy/pull/6766)
* [`or_fun_call`]: Improved suggestions for `or_insert(vec![])`
[#6790](https://github.com/rust-lang/rust-clippy/pull/6790)
* [`manual_map`]: No longer expands macros in the suggestions
[#6801](https://github.com/rust-lang/rust-clippy/pull/6801)
* Aligned Clippy's lint messages with the rustc dev guide
[#6787](https://github.com/rust-lang/rust-clippy/pull/6787)

### ICE Fixes

* [`zero_sized_map_values`]
[#6866](https://github.com/rust-lang/rust-clippy/pull/6866)

### Documentation Improvements

* [`useless_format`]: Improved the documentation example
[#6854](https://github.com/rust-lang/rust-clippy/pull/6854)
* Clippy's [`README.md`]: Includes a new subsection on running Clippy as a rustc wrapper
[#6782](https://github.com/rust-lang/rust-clippy/pull/6782)

### Others
* Running `cargo clippy` after `cargo check` now works as expected
(`cargo clippy` and `cargo check` no longer shares the same build cache)
[#6687](https://github.com/rust-lang/rust-clippy/pull/6687)
* Cargo now re-runs Clippy if arguments after `--` provided to `cargo clippy` are changed.
[#6834](https://github.com/rust-lang/rust-clippy/pull/6834)
* Extracted Clippy's `utils` module into the new `clippy_utils` crate
[#6756](https://github.com/rust-lang/rust-clippy/pull/6756)
* Clippy lintcheck tool improvements
[#6800](https://github.com/rust-lang/rust-clippy/pull/6800)
[#6735](https://github.com/rust-lang/rust-clippy/pull/6735)
[#6764](https://github.com/rust-lang/rust-clippy/pull/6764)
[#6708](https://github.com/rust-lang/rust-clippy/pull/6708)
[#6780](https://github.com/rust-lang/rust-clippy/pull/6780)
[#6686](https://github.com/rust-lang/rust-clippy/pull/6686)

## Rust 1.51

Current beta, release 2021-03-25
Current stable, released 2021-03-25

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

Expand Down Expand Up @@ -125,7 +260,7 @@ Current beta, release 2021-03-25

## Rust 1.50

Current stable, released 2021-02-11
Released 2021-02-11

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

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

<!-- lint disable no-unused-definitions -->
<!-- begin autogenerated links to lint list -->
Expand All @@ -1993,6 +2129,7 @@ Released 2018-09-13
[`borrowed_box`]: https://rust-lang.github.io/rust-clippy/master/index.html#borrowed_box
[`box_vec`]: https://rust-lang.github.io/rust-clippy/master/index.html#box_vec
[`boxed_local`]: https://rust-lang.github.io/rust-clippy/master/index.html#boxed_local
[`branches_sharing_code`]: https://rust-lang.github.io/rust-clippy/master/index.html#branches_sharing_code
[`builtin_type_shadow`]: https://rust-lang.github.io/rust-clippy/master/index.html#builtin_type_shadow
[`bytes_nth`]: https://rust-lang.github.io/rust-clippy/master/index.html#bytes_nth
[`cargo_common_metadata`]: https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata
Expand Down Expand Up @@ -2233,6 +2370,7 @@ Released 2018-09-13
[`needless_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect
[`needless_continue`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_continue
[`needless_doctest_main`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main
[`needless_for_each`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_for_each
[`needless_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
[`needless_pass_by_value`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
[`needless_question_mark`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
Expand All @@ -2246,13 +2384,15 @@ Released 2018-09-13
[`new_without_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
[`no_effect`]: https://rust-lang.github.io/rust-clippy/master/index.html#no_effect
[`non_ascii_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#non_ascii_literal
[`non_octal_unix_permissions`]: https://rust-lang.github.io/rust-clippy/master/index.html#non_octal_unix_permissions
[`nonminimal_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
[`nonsensical_open_options`]: https://rust-lang.github.io/rust-clippy/master/index.html#nonsensical_open_options
[`not_unsafe_ptr_arg_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
[`ok_expect`]: https://rust-lang.github.io/rust-clippy/master/index.html#ok_expect
[`op_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
[`option_as_ref_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_as_ref_deref
[`option_env_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_env_unwrap
[`option_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_filter_map
[`option_if_let_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
[`option_map_or_none`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_map_or_none
[`option_map_unit_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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

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

Lints are divided into categories, each with a default [lint level](https://doc.rust-lang.org/rustc/lints/levels.html).
You can choose how much Clippy is supposed to ~~annoy~~ help you by changing the lint level by category.
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn run(check: bool, verbose: bool) {
continue;
}

success &= rustfmt(context, &path)?;
success &= rustfmt(context, path)?;
}

Ok(success)
Expand Down
16 changes: 8 additions & 8 deletions src/tools/clippy/clippy_dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl Lint {
#[must_use]
pub fn gen_lint_group_list<'a>(lints: impl Iterator<Item = &'a Lint>) -> Vec<String> {
lints
.map(|l| format!(" LintId::of(&{}::{}),", l.module, l.name.to_uppercase()))
.map(|l| format!(" LintId::of({}::{}),", l.module, l.name.to_uppercase()))
.sorted()
.collect::<Vec<String>>()
}
Expand Down Expand Up @@ -154,17 +154,17 @@ pub fn gen_register_lint_list<'a>(
let header = " store.register_lints(&[".to_string();
let footer = " ]);".to_string();
let internal_lints = internal_lints
.sorted_by_key(|l| format!(" &{}::{},", l.module, l.name.to_uppercase()))
.sorted_by_key(|l| format!(" {}::{},", l.module, l.name.to_uppercase()))
.map(|l| {
format!(
" #[cfg(feature = \"internal-lints\")]\n &{}::{},",
" #[cfg(feature = \"internal-lints\")]\n {}::{},",
l.module,
l.name.to_uppercase()
)
});
let other_lints = usable_lints
.sorted_by_key(|l| format!(" &{}::{},", l.module, l.name.to_uppercase()))
.map(|l| format!(" &{}::{},", l.module, l.name.to_uppercase()))
.sorted_by_key(|l| format!(" {}::{},", l.module, l.name.to_uppercase()))
.map(|l| format!(" {}::{},", l.module, l.name.to_uppercase()))
.sorted();
let mut lint_list = vec![header];
lint_list.extend(internal_lints);
Expand Down Expand Up @@ -550,9 +550,9 @@ fn test_gen_lint_group_list() {
Lint::new("internal", "internal_style", "abc", None, "module_name"),
];
let expected = vec![
" LintId::of(&module_name::ABC),".to_string(),
" LintId::of(&module_name::INTERNAL),".to_string(),
" LintId::of(&module_name::SHOULD_ASSERT_EQ),".to_string(),
" LintId::of(module_name::ABC),".to_string(),
" LintId::of(module_name::INTERNAL),".to_string(),
" LintId::of(module_name::SHOULD_ASSERT_EQ),".to_string(),
];
assert_eq!(expected, gen_lint_group_list(lints.iter()));
}
Loading

0 comments on commit 7094eca

Please sign in to comment.