Skip to content

Commit be05190

Browse files
committed
Fix dogfood
1 parent 9309ce0 commit be05190

18 files changed

+41
-56
lines changed

clippy_lints/src/assertions_on_constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ enum AssertKind {
118118
fn match_assert_with_message<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Option<AssertKind> {
119119
if_chain! {
120120
if let Some(higher::If { cond, then, .. }) = higher::If::hir(expr);
121-
if let ExprKind::Unary(UnOp::Not, ref expr) = cond.kind;
121+
if let ExprKind::Unary(UnOp::Not, expr) = cond.kind;
122122
// bind the first argument of the `assert!` macro
123123
if let Some((Constant::Bool(is_true), _)) = constant(cx, cx.typeck_results(), expr);
124124
// block

clippy_lints/src/floating_point_arithmetic.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,6 @@ fn check_powi(cx: &LateContext<'_>, expr: &Expr<'_>, args: &[Expr<'_>]) {
332332
),
333333
Applicability::MachineApplicable,
334334
);
335-
336-
return;
337335
}
338336
}
339337
}

clippy_lints/src/functions/must_use.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub(super) fn check_item(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
2626
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
2727
if let Some(attr) = attr {
2828
check_needless_must_use(cx, sig.decl, item.hir_id(), item.span, fn_header_span, attr);
29-
return;
3029
} else if is_public && !is_proc_macro(cx.sess(), attrs) && !attrs.iter().any(|a| a.has_name(sym::no_mangle)) {
3130
check_must_use_candidate(
3231
cx,

clippy_lints/src/if_let_some_result.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ impl<'tcx> LateLintPass<'tcx> for OkIfLet {
4646
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
4747
if_chain! { //begin checking variables
4848
if let Some(higher::IfLet { let_pat, let_expr, .. }) = higher::IfLet::hir(cx, expr);
49-
if let ExprKind::MethodCall(_, ok_span, ref result_types, _) = let_expr.kind; //check is expr.ok() has type Result<T,E>.ok(, _)
50-
if let PatKind::TupleStruct(QPath::Resolved(_, ref x), ref y, _) = let_pat.kind; //get operation
49+
if let ExprKind::MethodCall(_, ok_span, result_types, _) = let_expr.kind; //check is expr.ok() has type Result<T,E>.ok(, _)
50+
if let PatKind::TupleStruct(QPath::Resolved(_, x), y, _) = let_pat.kind; //get operation
5151
if method_chain_args(let_expr, &["ok"]).is_some(); //test to see if using ok() methoduse std::marker::Sized;
5252
if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(&result_types[0]), sym::result_type);
5353
if rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| s.print_path(x, false)) == "Some";

clippy_lints/src/loops/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ impl<'tcx> LateLintPass<'tcx> for Loops {
580580

581581
while_let_on_iterator::check(cx, expr);
582582

583-
if let Some(higher::While { if_cond, if_then, .. }) = higher::While::hir(&expr) {
583+
if let Some(higher::While { if_cond, if_then, .. }) = higher::While::hir(expr) {
584584
while_immutable_condition::check(cx, if_cond, if_then);
585585
}
586586

clippy_lints/src/loops/while_let_loop.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ pub(super) fn check(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, loop_block: &'
2424
}
2525
}
2626

27-
if let ExprKind::Match(ref matchexpr, ref arms, MatchSource::Normal) = inner.kind {
27+
if let ExprKind::Match(matchexpr, arms, MatchSource::Normal) = inner.kind {
2828
if arms.len() == 2
2929
&& arms[0].guard.is_none()
3030
&& arms[1].guard.is_none()
31-
&& is_simple_break_expr(&arms[1].body)
31+
&& is_simple_break_expr(arms[1].body)
3232
{
33-
could_be_while_let(cx, expr, &arms[0].pat, matchexpr);
33+
could_be_while_let(cx, expr, arms[0].pat, matchexpr);
3434
}
3535
}
3636
}

clippy_lints/src/matches.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ impl<'tcx> LateLintPass<'tcx> for Matches {
631631
check_match_single_binding(cx, ex, arms, expr);
632632
}
633633
}
634-
if let ExprKind::Match(ref ex, ref arms, _) = expr.kind {
634+
if let ExprKind::Match(ex, arms, _) = expr.kind {
635635
check_match_ref_pats(cx, ex, arms.iter().map(|el| el.pat), expr);
636636
}
637637
if let Some(higher::IfLet { let_pat, let_expr, .. }) = higher::IfLet::hir(cx, expr) {
@@ -1194,7 +1194,7 @@ where
11941194

11951195
let (first_sugg, msg, title);
11961196
let span = ex.span.source_callsite();
1197-
if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, ref inner) = ex.kind {
1197+
if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, inner) = ex.kind {
11981198
first_sugg = once((span, Sugg::hir_with_macro_callsite(cx, inner, "..").to_string()));
11991199
msg = "try";
12001200
title = "you don't need to add `&` to both the expression and the patterns";
@@ -1205,7 +1205,7 @@ where
12051205
}
12061206

12071207
let remaining_suggs = pats.filter_map(|pat| {
1208-
if let PatKind::Ref(ref refp, _) = pat.kind {
1208+
if let PatKind::Ref(refp, _) = pat.kind {
12091209
Some((pat.span, snippet(cx, refp.span, "..").to_string()))
12101210
} else {
12111211
None
@@ -1365,7 +1365,7 @@ where
13651365
find_bool_lit(&arm.2.kind, is_if_let).map_or(false, |b| b == b0) && arm.3.is_none() && arm.0.is_empty()
13661366
});
13671367
then {
1368-
if let Some(ref last_pat) = last_pat_opt {
1368+
if let Some(last_pat) = last_pat_opt {
13691369
if !is_wild(last_pat) {
13701370
return false;
13711371
}
@@ -1827,13 +1827,13 @@ mod redundant_pattern_match {
18271827
..
18281828
}) = higher::IfLet::hir(cx, expr)
18291829
{
1830-
find_sugg_for_if_let(cx, expr, let_pat, let_expr, "if", if_else.is_some())
1830+
find_sugg_for_if_let(cx, expr, let_pat, let_expr, "if", if_else.is_some());
18311831
}
18321832
if let ExprKind::Match(op, arms, MatchSource::Normal) = &expr.kind {
1833-
find_sugg_for_match(cx, expr, op, arms)
1833+
find_sugg_for_match(cx, expr, op, arms);
18341834
}
18351835
if let Some(higher::WhileLet { let_pat, let_expr, .. }) = higher::WhileLet::hir(expr) {
1836-
find_sugg_for_if_let(cx, expr, let_pat, let_expr, "while", false)
1836+
find_sugg_for_if_let(cx, expr, let_pat, let_expr, "while", false);
18371837
}
18381838
}
18391839

clippy_lints/src/pattern_type_mismatch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<'tcx> LateLintPass<'tcx> for PatternTypeMismatch {
118118
}
119119
}
120120
if let ExprKind::Let(let_pat, let_expr, _) = expr.kind {
121-
if let Some(ref expr_ty) = cx.typeck_results().node_type_opt(let_expr.hir_id) {
121+
if let Some(expr_ty) = cx.typeck_results().node_type_opt(let_expr.hir_id) {
122122
if in_external_macro(cx.sess(), let_pat.span) {
123123
return;
124124
}

clippy_lints/src/question_mark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl QuestionMark {
106106
if let PatKind::Binding(annot, bind_id, _, _) = fields[0].kind;
107107
let by_ref = matches!(annot, BindingAnnotation::Ref | BindingAnnotation::RefMut);
108108

109-
if let ExprKind::Block(ref block, None) = if_then.kind;
109+
if let ExprKind::Block(block, None) = if_then.kind;
110110
if block.stmts.is_empty();
111111
if let Some(trailing_expr) = &block.expr;
112112
if path_to_local_id(trailing_expr, bind_id);

clippy_lints/src/ranges.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ fn check_range_zip_with_len(cx: &LateContext<'_>, path: &PathSegment<'_>, args:
337337
// `.iter()` and `.len()` called on same `Path`
338338
if let ExprKind::Path(QPath::Resolved(_, iter_path)) = iter_args[0].kind;
339339
if let ExprKind::Path(QPath::Resolved(_, len_path)) = len_args[0].kind;
340-
if SpanlessEq::new(cx).eq_path_segments(&iter_path.segments, &len_path.segments);
340+
if SpanlessEq::new(cx).eq_path_segments(iter_path.segments, len_path.segments);
341341
then {
342342
span_lint(cx,
343343
RANGE_ZIP_WITH_LEN,

0 commit comments

Comments
 (0)