Skip to content

Update Clippy #87579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e8f57c3
No longer suggest inserting or appending an underscore
th1000s May 13, 2021
2ac2188
Use diagnostic items for `BinaryHeap`, `BTreeMap`, `BTreeSet`, `HashM…
xFrednet Jul 14, 2021
6030428
Use diagnostic items for `Into`, `IntoIterator`, `LinkedList`, `ptr::…
xFrednet Jul 14, 2021
6ce6b29
Use diagnostic items for `intrinsics::transmute`, `TryInto`
xFrednet Jul 14, 2021
ecf85f4
Use diagnostic items for `Vec`, `VecDeque` and connected refactorings
xFrednet Jul 14, 2021
f882c36
fix(clippy): add missing allow(dyn_drop)
notriddle Jul 18, 2021
884ef4c
Merge commit '4c41a222ca5d1325fb4b6709395bd06e766cc042' into clippyup
flip1995 Jul 19, 2021
6103814
Auto merge of #7221 - th1000s:keyword_, r=giraffate
bors Jul 19, 2021
24ec35a
Enhance needless continue to detect loop {continue;}
F3real Jul 20, 2021
9d6127c
Emit needless_continue warning if loop ends on continue
F3real Jul 21, 2021
c3452f3
Lint on continue expression without semi-colon
F3real Jul 22, 2021
544c462
Documented constant expression evaluation for `repeat_once`
xFrednet Jul 23, 2021
045dbb5
Clean up unnecessary unwraps
F3real Jul 23, 2021
1b8fc8f
update clippy ui test 'future_not_send.stderr' to match
chazkiker2 Jul 23, 2021
ea97a5a
Add clippy_utils and if_chain to extern crate list
camsteffen Jul 23, 2021
afe5962
clippy::author improvements
camsteffen Jul 23, 2021
ea69a9d
Auto merge of #7482 - xFrednet:7306-document-repeat-once-fp, r=giraffate
bors Jul 24, 2021
00faed9
Add generic arg infer
JulianKnodt Apr 24, 2021
8286824
Add inferred args to typeck
JulianKnodt Apr 26, 2021
5b914f6
Introduce OwnerNode::Crate.
cjgillot Jul 25, 2021
1270ed0
Auto merge of #83723 - cjgillot:ownernode, r=petrochenkov
bors Jul 25, 2021
f68629a
Explain flags missing in cargo check in --help
nfejzic Jul 25, 2021
d3492a0
author: check block.expr: None
camsteffen Jul 25, 2021
89c8c3f
Prefer a code snipped over formatting the self type (`new_without_def…
xFrednet Jul 25, 2021
6d9036b
Auto merge of #7484 - camsteffen:author, r=flip1995
bors Jul 26, 2021
02d70f3
Auto merge of #7477 - F3real:needless_continue, r=flip1995
bors Jul 26, 2021
7d6946d
Auto merge of #7485 - camsteffen:add-test-externs, r=flip1995
bors Jul 26, 2021
3214de3
Auto merge of #7493 - xFrednet:7220-fix-new-without-default-impl-type…
bors Jul 26, 2021
0e5802e
Include more information in --help
nfejzic Jul 26, 2021
3c517b3
Improve conflicting rlibs error again
camsteffen Jul 26, 2021
fd2b43d
Auto merge of #7495 - camsteffen:extern-conflict, r=Manishearth
bors Jul 26, 2021
74379d4
Actually infer args in visitors
JulianKnodt May 6, 2021
ceb7a86
Auto merge of #7466 - xFrednet:5393-use-more-diagnostic-items, r=flip…
bors Jul 27, 2021
f7af8bf
Handle `--no-deps` flag same as `--fix` flag.
nfejzic Jul 27, 2021
a1bab3b
Add primitive type support to disallowed_type lint
DevinR528 Jul 22, 2021
43905d9
Auto merge of #7488 - DevinR528:bantype-fix, r=camsteffen
bors Jul 27, 2021
ac0fd99
Auto merge of #7492 - nfejzic:improve_help, r=Manishearth
bors Jul 27, 2021
ea988af
Auto merge of #83484 - JulianKnodt:infer, r=oli-obk,lcnr
bors Jul 27, 2021
5331fea
Update tests
jhpratt Jun 3, 2021
6c5d199
Update deploy CI
flip1995 May 31, 2021
fe25282
Remove old python lint doc generation scripts
flip1995 Jul 28, 2021
12c6161
Update lint documentation to use markdown headlines
xFrednet Jul 2, 2021
9bc5803
Fix last occurence of **What it does:**
flip1995 Jul 28, 2021
322a768
Adapting the lint list to Clippy's new metadata format
xFrednet May 18, 2021
c951a3c
Run cargo collect-metadata in cargo dev serve
flip1995 Jul 28, 2021
ce46599
Rollup merge of #7279 - xFrednet:7172-adapt-website-to-new-format, r=…
flip1995 Jul 28, 2021
bcdf147
Rollup merge of #7298 - flip1995:ci-switch-to-monster, r=xFrednet,fli…
flip1995 Jul 28, 2021
464c85c
Rollup merge of #7420 - xFrednet:7172-update-lint-documentation, r=fl…
flip1995 Jul 28, 2021
92ca25b
Auto merge of #7502 - flip1995:rollup-y3ho3w0, r=flip1995
bors Jul 28, 2021
490beda
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Jul 29, 2021
7ed7b29
Bump nightly version -> 2021-07-29
flip1995 Jul 29, 2021
80116f9
Bump Clippy Version -> 0.1.56
flip1995 Jul 29, 2021
766f09f
Auto merge of #7503 - flip1995:rustup, r=flip1995
bors Jul 29, 2021
54e5391
Rename two lints to comply with our lint naming convention
flip1995 Jul 29, 2021
0cce3f6
Auto merge of #7504 - flip1995:rename-lints, r=flip1995
bors Jul 29, 2021
72d655b
Merge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyup
flip1995 Jul 29, 2021
8570a36
Update Cargo.lock (Clippy version bump)
flip1995 Jul 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2423,7 +2423,6 @@ Released 2018-09-13
<!-- begin autogenerated links to lint list -->
[`absurd_extreme_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#absurd_extreme_comparisons
[`almost_swapped`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_swapped
[`append_instead_of_extend`]: https://rust-lang.github.io/rust-clippy/master/index.html#append_instead_of_extend
[`approx_constant`]: https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant
[`as_conversions`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions
[`assertions_on_constants`]: https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_constants
Expand Down Expand Up @@ -2522,6 +2521,7 @@ Released 2018-09-13
[`explicit_iter_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
[`explicit_write`]: https://rust-lang.github.io/rust-clippy/master/index.html#explicit_write
[`extend_from_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#extend_from_slice
[`extend_with_drain`]: https://rust-lang.github.io/rust-clippy/master/index.html#extend_with_drain
[`extra_unused_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
[`fallible_impl_from`]: https://rust-lang.github.io/rust-clippy/master/index.html#fallible_impl_from
[`field_reassign_with_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
Expand Down Expand Up @@ -2772,7 +2772,7 @@ Released 2018-09-13
[`same_item_push`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push
[`search_is_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
[`self_assignment`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_assignment
[`self_named_constructor`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_named_constructor
[`self_named_constructors`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_named_constructors
[`semicolon_if_nothing_returned`]: https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
[`serde_api_misuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#serde_api_misuse
[`shadow_reuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#shadow_reuse
Expand Down
16 changes: 8 additions & 8 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ mod regex;
mod repeat_once;
mod returns;
mod self_assignment;
mod self_named_constructor;
mod self_named_constructors;
mod semicolon_if_nothing_returned;
mod serde_api;
mod shadow;
Expand Down Expand Up @@ -740,7 +740,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
mem_replace::MEM_REPLACE_WITH_DEFAULT,
mem_replace::MEM_REPLACE_WITH_UNINIT,
methods::APPEND_INSTEAD_OF_EXTEND,
methods::BIND_INSTEAD_OF_MAP,
methods::BYTES_NTH,
methods::CHARS_LAST_CMP,
Expand All @@ -751,6 +750,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
methods::CLONE_ON_REF_PTR,
methods::EXPECT_FUN_CALL,
methods::EXPECT_USED,
methods::EXTEND_WITH_DRAIN,
methods::FILETYPE_IS_FILE,
methods::FILTER_MAP_IDENTITY,
methods::FILTER_MAP_NEXT,
Expand Down Expand Up @@ -900,7 +900,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
returns::LET_AND_RETURN,
returns::NEEDLESS_RETURN,
self_assignment::SELF_ASSIGNMENT,
self_named_constructor::SELF_NAMED_CONSTRUCTOR,
self_named_constructors::SELF_NAMED_CONSTRUCTORS,
semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED,
serde_api::SERDE_API_MISUSE,
shadow::SHADOW_REUSE,
Expand Down Expand Up @@ -1296,14 +1296,14 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
LintId::of(mem_replace::MEM_REPLACE_WITH_DEFAULT),
LintId::of(mem_replace::MEM_REPLACE_WITH_UNINIT),
LintId::of(methods::APPEND_INSTEAD_OF_EXTEND),
LintId::of(methods::BIND_INSTEAD_OF_MAP),
LintId::of(methods::BYTES_NTH),
LintId::of(methods::CHARS_LAST_CMP),
LintId::of(methods::CHARS_NEXT_CMP),
LintId::of(methods::CLONE_DOUBLE_REF),
LintId::of(methods::CLONE_ON_COPY),
LintId::of(methods::EXPECT_FUN_CALL),
LintId::of(methods::EXTEND_WITH_DRAIN),
LintId::of(methods::FILTER_MAP_IDENTITY),
LintId::of(methods::FILTER_NEXT),
LintId::of(methods::FLAT_MAP_IDENTITY),
Expand Down Expand Up @@ -1407,7 +1407,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(returns::LET_AND_RETURN),
LintId::of(returns::NEEDLESS_RETURN),
LintId::of(self_assignment::SELF_ASSIGNMENT),
LintId::of(self_named_constructor::SELF_NAMED_CONSTRUCTOR),
LintId::of(self_named_constructors::SELF_NAMED_CONSTRUCTORS),
LintId::of(serde_api::SERDE_API_MISUSE),
LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT),
Expand Down Expand Up @@ -1561,7 +1561,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES),
LintId::of(returns::LET_AND_RETURN),
LintId::of(returns::NEEDLESS_RETURN),
LintId::of(self_named_constructor::SELF_NAMED_CONSTRUCTOR),
LintId::of(self_named_constructors::SELF_NAMED_CONSTRUCTORS),
LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
LintId::of(tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
LintId::of(to_digit_is_some::TO_DIGIT_IS_SOME),
Expand Down Expand Up @@ -1762,8 +1762,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(large_enum_variant::LARGE_ENUM_VARIANT),
LintId::of(loops::MANUAL_MEMCPY),
LintId::of(loops::NEEDLESS_COLLECT),
LintId::of(methods::APPEND_INSTEAD_OF_EXTEND),
LintId::of(methods::EXPECT_FUN_CALL),
LintId::of(methods::EXTEND_WITH_DRAIN),
LintId::of(methods::ITER_NTH),
LintId::of(methods::MANUAL_STR_REPEAT),
LintId::of(methods::OR_FUN_CALL),
Expand Down Expand Up @@ -2104,7 +2104,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
let scripts = conf.allowed_scripts.clone();
store.register_early_pass(move || box disallowed_script_idents::DisallowedScriptIdents::new(&scripts));
store.register_late_pass(|| box strlen_on_c_strings::StrlenOnCStrings);
store.register_late_pass(move || box self_named_constructor::SelfNamedConstructor);
store.register_late_pass(move || box self_named_constructors::SelfNamedConstructors);
}

#[rustfmt::skip]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_hir::{Expr, ExprKind, LangItem};
use rustc_lint::LateContext;
use rustc_span::symbol::sym;

use super::APPEND_INSTEAD_OF_EXTEND;
use super::EXTEND_WITH_DRAIN;

pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, arg: &Expr<'_>) {
let ty = cx.typeck_results().expr_ty(recv).peel_refs();
Expand All @@ -25,7 +25,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, arg:
let mut applicability = Applicability::MachineApplicable;
span_lint_and_sugg(
cx,
APPEND_INSTEAD_OF_EXTEND,
EXTEND_WITH_DRAIN,
expr.span,
"use of `extend` instead of `append` for adding the full range of a second vector",
"try this",
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
mod append_instead_of_extend;
mod bind_instead_of_map;
mod bytes_nth;
mod chars_cmp;
Expand All @@ -12,6 +11,7 @@ mod clone_on_ref_ptr;
mod cloned_instead_of_copied;
mod expect_fun_call;
mod expect_used;
mod extend_with_drain;
mod filetype_is_file;
mod filter_map;
mod filter_map_identity;
Expand Down Expand Up @@ -1068,7 +1068,7 @@ declare_clippy_lint! {
/// // Good
/// a.append(&mut b);
/// ```
pub APPEND_INSTEAD_OF_EXTEND,
pub EXTEND_WITH_DRAIN,
perf,
"using vec.append(&mut vec) to move the full range of a vecor to another"
}
Expand Down Expand Up @@ -1821,7 +1821,7 @@ impl_lint_pass!(Methods => [
IMPLICIT_CLONE,
SUSPICIOUS_SPLITN,
MANUAL_STR_REPEAT,
APPEND_INSTEAD_OF_EXTEND
EXTEND_WITH_DRAIN
]);

/// Extracts a method call name, args, and `Span` of the method name.
Expand Down Expand Up @@ -2085,7 +2085,7 @@ fn check_methods<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, msrv: Optio
},
("extend", [arg]) => {
string_extend_chars::check(cx, expr, recv, arg);
append_instead_of_extend::check(cx, expr, recv, arg);
extend_with_drain::check(cx, expr, recv, arg);
},
("filter_map", [arg]) => {
unnecessary_filter_map::check(cx, expr, arg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ declare_clippy_lint! {
/// }
/// }
/// ```
pub SELF_NAMED_CONSTRUCTOR,
pub SELF_NAMED_CONSTRUCTORS,
style,
"method should not have the same name as the type it is implemented for"
}

declare_lint_pass!(SelfNamedConstructor => [SELF_NAMED_CONSTRUCTOR]);
declare_lint_pass!(SelfNamedConstructors => [SELF_NAMED_CONSTRUCTORS]);

impl<'tcx> LateLintPass<'tcx> for SelfNamedConstructor {
impl<'tcx> LateLintPass<'tcx> for SelfNamedConstructors {
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx ImplItem<'_>) {
match impl_item.kind {
ImplItemKind::Fn(ref sig, _) => {
Expand Down Expand Up @@ -80,7 +80,7 @@ impl<'tcx> LateLintPass<'tcx> for SelfNamedConstructor {
then {
span_lint(
cx,
SELF_NAMED_CONSTRUCTOR,
SELF_NAMED_CONSTRUCTORS,
impl_item.span,
&format!("constructor `{}` has the same name as the type", impl_item.ident.name),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![warn(clippy::append_instead_of_extend)]
#![warn(clippy::extend_with_drain)]
use std::collections::BinaryHeap;
fn main() {
//gets linted
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![warn(clippy::append_instead_of_extend)]
#![warn(clippy::extend_with_drain)]
use std::collections::BinaryHeap;
fn main() {
//gets linted
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error: use of `extend` instead of `append` for adding the full range of a second vector
--> $DIR/append_instead_of_extend.rs:9:5
--> $DIR/extend_with_drain.rs:9:5
|
LL | vec2.extend(vec1.drain(..));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec2.append(&mut vec1)`
|
= note: `-D clippy::append-instead-of-extend` implied by `-D warnings`
= note: `-D clippy::extend-with-drain` implied by `-D warnings`

error: use of `extend` instead of `append` for adding the full range of a second vector
--> $DIR/append_instead_of_extend.rs:14:5
--> $DIR/extend_with_drain.rs:14:5
|
LL | vec4.extend(vec3.drain(..));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec4.append(&mut vec3)`

error: use of `extend` instead of `append` for adding the full range of a second vector
--> $DIR/append_instead_of_extend.rs:18:5
--> $DIR/extend_with_drain.rs:18:5
|
LL | vec11.extend(return_vector().drain(..));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec11.append(&mut return_vector())`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/needless_bool/fixable.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
clippy::no_effect,
clippy::if_same_then_else,
clippy::needless_return,
clippy::self_named_constructor
clippy::self_named_constructors
)]

use std::cell::Cell;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/needless_bool/fixable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
clippy::no_effect,
clippy::if_same_then_else,
clippy::needless_return,
clippy::self_named_constructor
clippy::self_named_constructors
)]

use std::cell::Cell;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![warn(clippy::self_named_constructor)]
#![warn(clippy::self_named_constructors)]

struct ShouldSpawn;
struct ShouldNotSpawn;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
error: constructor `should_spawn` has the same name as the type
--> $DIR/self_named_constructor.rs:7:5
--> $DIR/self_named_constructors.rs:7:5
|
LL | / pub fn should_spawn() -> ShouldSpawn {
LL | | ShouldSpawn
LL | | }
| |_____^
|
= note: `-D clippy::self-named-constructor` implied by `-D warnings`
= note: `-D clippy::self-named-constructors` implied by `-D warnings`

error: aborting due to previous error

2 changes: 1 addition & 1 deletion tests/ui/unit_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
clippy::unnecessary_wraps,
clippy::or_fun_call,
clippy::needless_question_mark,
clippy::self_named_constructor
clippy::self_named_constructors
)]

use std::fmt::Debug;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/use_self.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
clippy::should_implement_trait,
clippy::upper_case_acronyms,
clippy::from_over_into,
clippy::self_named_constructor
clippy::self_named_constructors
)]

#[macro_use]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/use_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
clippy::should_implement_trait,
clippy::upper_case_acronyms,
clippy::from_over_into,
clippy::self_named_constructor
clippy::self_named_constructors
)]

#[macro_use]
Expand Down