Skip to content

Update Clippy #92036

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 63 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
063f8aa
Ignore associated types in traits when considering type complexity
WaffleLapkin Nov 25, 2021
40a6c51
Update tests for type_complexity lint
WaffleLapkin Nov 25, 2021
99eeb66
Fix tools
fee1-dead Nov 29, 2021
dd03c0f
Auto merge of #91354 - fee1-dead:const_env, r=spastorino
bors Dec 2, 2021
23f752f
Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"
spastorino Dec 3, 2021
c813bfa
Add initial AST and MIR support for unwinding from inline assembly
Amanieu Aug 30, 2021
35a0060
Use IntoIterator for array impl everywhere.
m-ou-se Sep 3, 2021
01ca66c
Fix FP on `question_mark` if returned object is not local
dswij Dec 6, 2021
8fea1d9
Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyup
flip1995 Dec 6, 2021
4a39707
Parenthesize blocks in `needless_bool` suggestion
llogiq Dec 2, 2021
9e08527
Auto merge of #8066 - rust-lang:needless_bool_parenthesize, r=camsteffen
bors Dec 6, 2021
284b63a
Rename remove_blocks to peel_blocks
camsteffen Apr 1, 2021
f690ef6
Refactors with peel_blocks
camsteffen Nov 29, 2021
16bbd24
Simplify needless_bool
camsteffen Mar 25, 2021
48d939f
Auto merge of #8042 - camsteffen:peel-blocks, r=xFrednet
bors Dec 6, 2021
f615ea4
Auto merge of #8080 - dswij:8019, r=giraffate
bors Dec 7, 2021
d91b91a
`needless_lifetimes` Known problems typo
jqnatividad Dec 7, 2021
1c7df44
Auto merge of #8085 - jqnatividad:8084-needless_lifetimes_typo, r=gir…
bors Dec 7, 2021
b5fa5b3
`option_if_let_else` Do not warn when complex subpat is present
dswij Dec 7, 2021
ee0d71e
Clarify the purpose of the lint
Qwaz Dec 4, 2021
c0fd250
Fix grammar issues
Qwaz Dec 7, 2021
5d63a28
Move `non_send_fields_in_send_ty` back to `nursery`
Qwaz Dec 7, 2021
ecae70f
Auto merge of #8075 - Qwaz:non_send_fields_documentation, r=xFrednet
bors Dec 7, 2021
86cea73
Auto merge of #8086 - dswij:7991, r=giraffate
bors Dec 7, 2021
8dfb3ec
Add new lint to warn when #[must_use] attribute should be used on a m…
GuillaumeGomez Dec 3, 2021
2b35edb
Update other UI tests as well
GuillaumeGomez Dec 3, 2021
e93767b
Apply new lint on clippy source code
GuillaumeGomez Dec 3, 2021
c176568
Ignore associated items in trait *implementations* when considering t…
WaffleLapkin Dec 8, 2021
3c8f90b
Auto merge of #8030 - WaffleLapkin:ignore_trait_assoc_types_type_comp…
bors Dec 8, 2021
5305979
Auto merge of #8071 - GuillaumeGomez:method-must-use, r=xFrednet
bors Dec 8, 2021
460bef2
Remove and ignore lintcheck's log file
xFrednet Nov 28, 2021
392b2ef
Fix `blocks_in_if_conditions` false positive
c410-f3r Dec 8, 2021
4520529
Remind users of separate `rustc` lint groups
medwards Dec 9, 2021
5abecad
Auto merge of #8106 - medwards:rustc-lint-groups, r=flip1995
bors Dec 9, 2021
e42f79c
Add `filter` option to lintcheck
xFrednet Dec 8, 2021
4a4f092
Auto merge of #8096 - xFrednet:0000-remove-lintcheck-log-file, r=matt…
bors Dec 9, 2021
d6fca46
Update lintcheck output to use tables and add markdown support
xFrednet Dec 9, 2021
d27f598
Auto merge of #8110 - xFrednet:0000-lintcheck-markdown-output, r=matt…
bors Dec 9, 2021
aa3648a
Auto merge of #8100 - c410-f3r:blah-blah-blah, r=giraffate
bors Dec 9, 2021
adf8c38
Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"
fee1-dead Dec 12, 2021
603b865
clippy owo
BoxyUwU Dec 12, 2021
41c48bd
Auto merge of #91549 - fee1-dead:const_env, r=spastorino
bors Dec 12, 2021
e1139cf
Fix clippy tests
Amanieu Dec 13, 2021
468c86e
Add `unnecessary_to_owned` lint
smoelius Nov 16, 2021
290f74b
Address review comments
smoelius Nov 30, 2021
3807905
Handle `to_vec` on for loop expression #8069
smoelius Dec 13, 2021
d8af82e
Fix clippy uses of QPath::LangItem
estebank Nov 16, 2021
1c3747e
Fix rebase and clippy tests
estebank Nov 16, 2021
c5287b3
fix clippy tests
estebank Dec 10, 2021
cb609a9
Add comma
smoelius Dec 13, 2021
6b6cc5d
Auto merge of #91728 - Amanieu:stable_asm, r=joshtriplett
bors Dec 14, 2021
288afb3
Remove iter::zip feature gate from clippy
Patrick-Poitras Dec 14, 2021
3beb6b1
Address review comments
smoelius Dec 14, 2021
b166642
Rollup merge of #90939 - estebank:wg-af-polish, r=tmandry
matthiaskrgr Dec 15, 2021
55df990
Rollup merge of #91881 - Patrick-Poitras:stabilize-iter-zip, r=scottmcm
matthiaskrgr Dec 15, 2021
f8817f6
Stabilize `destructuring_assignment`
jhpratt Nov 3, 2021
b2f8a27
Rollup merge of #90521 - jhpratt:stabilize-destructuring_assignment, …
matthiaskrgr Dec 15, 2021
b891389
Expand `is_clone_like` comment
smoelius Dec 15, 2021
40fd785
Auto merge of #7978 - smoelius:master, r=llogiq
bors Dec 15, 2021
fad9407
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Dec 17, 2021
646a9cf
Bump nightly version -> 2021-12-17
flip1995 Dec 17, 2021
23d1142
Auto merge of #8134 - flip1995:rustup, r=flip1995
bors Dec 17, 2021
f1a779c
Merge commit '23d11428de3e973b34a5090a78d62887f821c90e' into clippyup
flip1995 Dec 17, 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: 3 additions & 1 deletion src/tools/clippy/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ out
# Generated by dogfood
/target_recur/

# Generated by lintcheck
/lintcheck-logs

# gh pages docs
util/gh-pages/lints.json
**/metadata_collection.json

# rustfmt backups
*.rs.bk
Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3118,6 +3118,7 @@ Released 2018-09-13
[`result_map_or_into_option`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_map_or_into_option
[`result_map_unit_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_map_unit_fn
[`result_unit_err`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_unit_err
[`return_self_not_must_use`]: https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
[`reversed_empty_ranges`]: https://rust-lang.github.io/rust-clippy/master/index.html#reversed_empty_ranges
[`same_functions_in_if_condition`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_functions_in_if_condition
[`same_item_push`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push
Expand Down Expand Up @@ -3209,6 +3210,7 @@ Released 2018-09-13
[`unnecessary_operation`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation
[`unnecessary_self_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_self_imports
[`unnecessary_sort_by`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by
[`unnecessary_to_owned`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned
[`unnecessary_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap
[`unnecessary_wraps`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
[`unneeded_field_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_field_pattern
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ define the `CLIPPY_DISABLE_DOCS_LINKS` environment variable.

You can add options to your code to `allow`/`warn`/`deny` Clippy lints:

* the whole set of `Warn` lints using the `clippy` lint group (`#![deny(clippy::all)]`)
* the whole set of `Warn` lints using the `clippy` lint group (`#![deny(clippy::all)]`).
Note that `rustc` has additional [lint groups](https://doc.rust-lang.org/rustc/lints/groups.html).

* all lints using both the `clippy` and `clippy::pedantic` lint groups (`#![deny(clippy::all)]`,
`#![deny(clippy::pedantic)]`). Note that `clippy::pedantic` contains some very aggressive
Expand Down
4 changes: 4 additions & 0 deletions src/tools/clippy/clippy_lints/src/asm_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ declare_clippy_lint! {
/// ```rust,no_run
/// # #![feature(asm)]
/// # unsafe { let ptr = "".as_ptr();
/// # use std::arch::asm;
/// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr);
/// # }
/// ```
/// Use instead:
/// ```rust,no_run
/// # #![feature(asm)]
/// # unsafe { let ptr = "".as_ptr();
/// # use std::arch::asm;
/// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax));
/// # }
/// ```
Expand Down Expand Up @@ -102,13 +104,15 @@ declare_clippy_lint! {
/// ```rust,no_run
/// # #![feature(asm)]
/// # unsafe { let ptr = "".as_ptr();
/// # use std::arch::asm;
/// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax));
/// # }
/// ```
/// Use instead:
/// ```rust,no_run
/// # #![feature(asm)]
/// # unsafe { let ptr = "".as_ptr();
/// # use std::arch::asm;
/// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr);
/// # }
/// ```
Expand Down
12 changes: 2 additions & 10 deletions src/tools/clippy/clippy_lints/src/assertions_on_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clippy_utils::consts::{constant, Constant};
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::higher;
use clippy_utils::source::snippet_opt;
use clippy_utils::{is_direct_expn_of, is_expn_of, match_panic_call};
use clippy_utils::{is_direct_expn_of, is_expn_of, match_panic_call, peel_blocks};
use if_chain::if_chain;
use rustc_hir::{Expr, ExprKind, UnOp};
use rustc_lint::{LateContext, LateLintPass};
Expand Down Expand Up @@ -122,15 +122,7 @@ fn match_assert_with_message<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>)
if let ExprKind::Unary(UnOp::Not, expr) = cond.kind;
// bind the first argument of the `assert!` macro
if let Some((Constant::Bool(is_true), _)) = constant(cx, cx.typeck_results(), expr);
// block
if let ExprKind::Block(block, _) = then.kind;
if block.stmts.is_empty();
if let Some(block_expr) = &block.expr;
// inner block is optional. unwrap it if it exists, or use the expression as is otherwise.
if let Some(begin_panic_call) = match block_expr.kind {
ExprKind::Block(inner_block, _) => &inner_block.expr,
_ => &block.expr,
};
let begin_panic_call = peel_blocks(then);
// function call
if let Some(arg) = match_panic_call(cx, begin_panic_call);
// bind the second argument of the `assert!` macro if it exists
Expand Down
8 changes: 5 additions & 3 deletions src/tools/clippy/clippy_lints/src/blocks_in_if_conditions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ impl<'a, 'tcx> Visitor<'tcx> for ExVisitor<'a, 'tcx> {

let body = self.cx.tcx.hir().body(eid);
let ex = &body.value;
if matches!(ex.kind, ExprKind::Block(_, _)) && !body.value.span.from_expansion() {
self.found_block = Some(ex);
return;
if let ExprKind::Block(block, _) = ex.kind {
if !body.value.span.from_expansion() && !block.stmts.is_empty() {
self.found_block = Some(ex);
return;
}
}
}
walk_expr(self, expr);
Expand Down
6 changes: 3 additions & 3 deletions src/tools/clippy/clippy_lints/src/bytecount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::source::snippet_with_applicability;
use clippy_utils::ty::match_type;
use clippy_utils::visitors::is_local_used;
use clippy_utils::{path_to_local_id, paths, peel_ref_operators, remove_blocks, strip_pat_refs};
use clippy_utils::{path_to_local_id, paths, peel_blocks, peel_ref_operators, strip_pat_refs};
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir::{BinOpKind, Expr, ExprKind, PatKind};
Expand Down Expand Up @@ -42,7 +42,7 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount {
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
if_chain! {
if let ExprKind::MethodCall(count, _, [count_recv], _) = expr.kind;
if count.ident.name == sym!(count);
if count.ident.name == sym::count;
if let ExprKind::MethodCall(filter, _, [filter_recv, filter_arg], _) = count_recv.kind;
if filter.ident.name == sym!(filter);
if let ExprKind::Closure(_, _, body_id, _, _) = filter_arg.kind;
Expand All @@ -55,7 +55,7 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount {
cx.typeck_results().expr_ty(filter_recv).peel_refs(),
&paths::SLICE_ITER);
let operand_is_arg = |expr| {
let expr = peel_ref_operators(cx, remove_blocks(expr));
let expr = peel_ref_operators(cx, peel_blocks(expr));
path_to_local_id(expr, arg_id)
};
let needle = if operand_is_arg(l) {
Expand Down
20 changes: 3 additions & 17 deletions src/tools/clippy/clippy_lints/src/collapsible_match.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::higher::IfLetOrMatch;
use clippy_utils::visitors::is_local_used;
use clippy_utils::{is_lang_ctor, is_unit_expr, path_to_local, peel_ref_operators, SpanlessEq};
use clippy_utils::{is_lang_ctor, is_unit_expr, path_to_local, peel_blocks_with_stmt, peel_ref_operators, SpanlessEq};
use if_chain::if_chain;
use rustc_hir::LangItem::OptionNone;
use rustc_hir::{Arm, Expr, ExprKind, Guard, HirId, Pat, PatKind, StmtKind};
use rustc_hir::{Arm, Expr, Guard, HirId, Pat, PatKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::{MultiSpan, Span};
Expand Down Expand Up @@ -75,7 +75,7 @@ fn check_arm<'tcx>(
outer_guard: Option<&'tcx Guard<'tcx>>,
outer_else_body: Option<&'tcx Expr<'tcx>>,
) {
let inner_expr = strip_singleton_blocks(outer_then_body);
let inner_expr = peel_blocks_with_stmt(outer_then_body);
if_chain! {
if let Some(inner) = IfLetOrMatch::parse(cx, inner_expr);
if let Some((inner_scrutinee, inner_then_pat, inner_else_body)) = match inner {
Expand Down Expand Up @@ -138,20 +138,6 @@ fn check_arm<'tcx>(
}
}

fn strip_singleton_blocks<'hir>(mut expr: &'hir Expr<'hir>) -> &'hir Expr<'hir> {
while let ExprKind::Block(block, _) = expr.kind {
match (block.stmts, block.expr) {
([stmt], None) => match stmt.kind {
StmtKind::Expr(e) | StmtKind::Semi(e) => expr = e,
_ => break,
},
([], Some(e)) => expr = e,
_ => break,
}
}
expr
}

/// A "wild-like" arm has a wild (`_`) or `None` pattern and no guard. Such arms can be "collapsed"
/// into a single wild arm without any significant loss in semantics or readability.
fn arm_is_wild_like(cx: &LateContext<'_>, arm: &Arm<'_>) -> bool {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/derivable_impls.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::{is_automatically_derived, is_default_equivalent, remove_blocks};
use clippy_utils::{is_automatically_derived, is_default_equivalent, peel_blocks};
use rustc_hir::{
def::{DefKind, Res},
Body, Expr, ExprKind, GenericArg, Impl, ImplItemKind, Item, ItemKind, Node, PathSegment, QPath, TyKind,
Expand Down Expand Up @@ -95,7 +95,7 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
}
}
}
let should_emit = match remove_blocks(func_expr).kind {
let should_emit = match peel_blocks(func_expr).kind {
ExprKind::Tup(fields) => fields.iter().all(|e| is_default_equivalent(cx, e)),
ExprKind::Call(callee, args)
if is_path_self(callee) => args.iter().all(|e| is_default_equivalent(cx, e)),
Expand Down
12 changes: 4 additions & 8 deletions src/tools/clippy/clippy_lints/src/floating_point_arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use clippy_utils::consts::{
};
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::higher;
use clippy_utils::{eq_expr_value, get_parent_expr, in_constant, numeric_literal, sugg};
use clippy_utils::{eq_expr_value, get_parent_expr, in_constant, numeric_literal, peel_blocks, sugg};
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir::{BinOpKind, Expr, ExprKind, PathSegment, UnOp};
Expand Down Expand Up @@ -546,13 +546,9 @@ fn are_negated<'a>(cx: &LateContext<'_>, expr1: &'a Expr<'a>, expr2: &'a Expr<'a

fn check_custom_abs(cx: &LateContext<'_>, expr: &Expr<'_>) {
if_chain! {
if let Some(higher::If { cond, then, r#else }) = higher::If::hir(expr);
if let ExprKind::Block(block, _) = then.kind;
if block.stmts.is_empty();
if let Some(if_body_expr) = block.expr;
if let Some(ExprKind::Block(else_block, _)) = r#else.map(|el| &el.kind);
if else_block.stmts.is_empty();
if let Some(else_body_expr) = else_block.expr;
if let Some(higher::If { cond, then, r#else: Some(r#else) }) = higher::If::hir(expr);
let if_body_expr = peel_blocks(then);
let else_body_expr = peel_blocks(r#else);
if let Some((if_expr_positive, body)) = are_negated(cx, if_body_expr, else_body_expr);
then {
let positive_abs_sugg = (
Expand Down
7 changes: 2 additions & 5 deletions src/tools/clippy/clippy_lints/src/if_then_some_else_none.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::source::snippet_with_macro_callsite;
use clippy_utils::{contains_return, higher, is_else_clause, is_lang_ctor, meets_msrv, msrvs};
use clippy_utils::{contains_return, higher, is_else_clause, is_lang_ctor, meets_msrv, msrvs, peel_blocks};
use if_chain::if_chain;
use rustc_hir::LangItem::{OptionNone, OptionSome};
use rustc_hir::{Expr, ExprKind, Stmt, StmtKind};
Expand Down Expand Up @@ -77,10 +77,7 @@ impl LateLintPass<'_> for IfThenSomeElseNone {
if let ExprKind::Call(then_call, [then_arg]) = then_expr.kind;
if let ExprKind::Path(ref then_call_qpath) = then_call.kind;
if is_lang_ctor(cx, then_call_qpath, OptionSome);
if let ExprKind::Block(els_block, _) = els.kind;
if els_block.stmts.is_empty();
if let Some(els_expr) = els_block.expr;
if let ExprKind::Path(ref qpath) = els_expr.kind;
if let ExprKind::Path(ref qpath) = peel_blocks(els).kind;
if is_lang_ctor(cx, qpath, OptionNone);
if !stmts_contains_early_return(then_block.stmts);
then {
Expand Down
16 changes: 5 additions & 11 deletions src/tools/clippy/clippy_lints/src/implicit_saturating_sub.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::higher;
use clippy_utils::SpanlessEq;
use clippy_utils::{higher, peel_blocks_with_stmt, SpanlessEq};
use if_chain::if_chain;
use rustc_ast::ast::LitKind;
use rustc_errors::Applicability;
use rustc_hir::{lang_items::LangItem, BinOpKind, Expr, ExprKind, QPath, StmtKind};
use rustc_hir::{lang_items::LangItem, BinOpKind, Expr, ExprKind, QPath};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};

Expand Down Expand Up @@ -52,13 +51,8 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitSaturatingSub {
// Ensure that the binary operator is >, != and <
if BinOpKind::Ne == cond_op.node || BinOpKind::Gt == cond_op.node || BinOpKind::Lt == cond_op.node;

// Check if the true condition block has only one statement
if let ExprKind::Block(block, _) = then.kind;
if block.stmts.len() == 1 && block.expr.is_none();

// Check if assign operation is done
if let StmtKind::Semi(e) = block.stmts[0].kind;
if let Some(target) = subtracts_one(cx, e);
if let Some(target) = subtracts_one(cx, then);

// Extracting out the variable name
if let ExprKind::Path(QPath::Resolved(_, ares_path)) = target.kind;
Expand Down Expand Up @@ -138,8 +132,8 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitSaturatingSub {
}
}

fn subtracts_one<'a>(cx: &LateContext<'_>, expr: &Expr<'a>) -> Option<&'a Expr<'a>> {
match expr.kind {
fn subtracts_one<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<&'a Expr<'a>> {
match peel_blocks_with_stmt(expr).kind {
ExprKind::AssignOp(ref op1, target, value) => {
if_chain! {
if BinOpKind::Sub == op1.node;
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/clippy_lints/src/lib.register_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
LintId::of(methods::UNNECESSARY_FILTER_MAP),
LintId::of(methods::UNNECESSARY_FOLD),
LintId::of(methods::UNNECESSARY_LAZY_EVALUATIONS),
LintId::of(methods::UNNECESSARY_TO_OWNED),
LintId::of(methods::UNWRAP_OR_ELSE_DEFAULT),
LintId::of(methods::USELESS_ASREF),
LintId::of(methods::WRONG_SELF_CONVENTION),
Expand Down Expand Up @@ -220,7 +221,6 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS),
LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY),
LintId::of(octal_escapes::OCTAL_ESCAPES),
LintId::of(open_options::NONSENSICAL_OPEN_OPTIONS),
LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP),
Expand All @@ -246,6 +246,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
LintId::of(reference::REF_IN_DEREF),
LintId::of(regex::INVALID_REGEX),
LintId::of(repeat_once::REPEAT_ONCE),
LintId::of(return_self_not_must_use::RETURN_SELF_NOT_MUST_USE),
LintId::of(returns::LET_AND_RETURN),
LintId::of(returns::NEEDLESS_RETURN),
LintId::of(self_assignment::SELF_ASSIGNMENT),
Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/clippy_lints/src/lib.register_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ store.register_lints(&[
methods::UNNECESSARY_FILTER_MAP,
methods::UNNECESSARY_FOLD,
methods::UNNECESSARY_LAZY_EVALUATIONS,
methods::UNNECESSARY_TO_OWNED,
methods::UNWRAP_OR_ELSE_DEFAULT,
methods::UNWRAP_USED,
methods::USELESS_ASREF,
Expand Down Expand Up @@ -422,6 +423,7 @@ store.register_lints(&[
regex::INVALID_REGEX,
regex::TRIVIAL_REGEX,
repeat_once::REPEAT_ONCE,
return_self_not_must_use::RETURN_SELF_NOT_MUST_USE,
returns::LET_AND_RETURN,
returns::NEEDLESS_RETURN,
same_name_method::SAME_NAME_METHOD,
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/clippy_lints/src/lib.register_nursery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
LintId::of(missing_const_for_fn::MISSING_CONST_FOR_FN),
LintId::of(mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),
LintId::of(mutex_atomic::MUTEX_INTEGER),
LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY),
LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES),
LintId::of(option_if_let_else::OPTION_IF_LET_ELSE),
LintId::of(path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE),
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/clippy_lints/src/lib.register_perf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ store.register_group(true, "clippy::perf", Some("clippy_perf"), vec![
LintId::of(methods::MANUAL_STR_REPEAT),
LintId::of(methods::OR_FUN_CALL),
LintId::of(methods::SINGLE_CHAR_PATTERN),
LintId::of(methods::UNNECESSARY_TO_OWNED),
LintId::of(misc::CMP_OWNED),
LintId::of(mutex_atomic::MUTEX_ATOMIC),
LintId::of(redundant_clone::REDUNDANT_CLONE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ store.register_group(true, "clippy::suspicious", Some("clippy_suspicious"), vec!
LintId::of(loops::MUT_RANGE_BOUND),
LintId::of(methods::SUSPICIOUS_MAP),
LintId::of(mut_key::MUTABLE_KEY_TYPE),
LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY),
LintId::of(octal_escapes::OCTAL_ESCAPES),
LintId::of(return_self_not_must_use::RETURN_SELF_NOT_MUST_USE),
LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
])
2 changes: 2 additions & 0 deletions src/tools/clippy/clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ mod ref_option_ref;
mod reference;
mod regex;
mod repeat_once;
mod return_self_not_must_use;
mod returns;
mod same_name_method;
mod self_assignment;
Expand Down Expand Up @@ -852,6 +853,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
store.register_late_pass(|| Box::new(trailing_empty_array::TrailingEmptyArray));
store.register_early_pass(|| Box::new(octal_escapes::OctalEscapes));
store.register_late_pass(|| Box::new(needless_late_init::NeedlessLateInit));
store.register_late_pass(|| Box::new(return_self_not_must_use::ReturnSelfNotMustUse));
// add lints here, do not remove this comment, it's used in `new_lint`
}

Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ declare_clippy_lint! {
///
/// ### Known problems
/// - We bail out if the function has a `where` clause where lifetimes
/// are mentioned due to potenial false positives.
/// are mentioned due to potential false positives.
/// - Lifetime bounds such as `impl Foo + 'a` and `T: 'a` must be elided with the
/// placeholder notation `'_` because the fully elided notation leaves the type bound to `'static`.
///
Expand Down
Loading