Auto merge of #7268 - mbartlett21:update_semi, r=Manishearth

Move `semicolon_if_nothing_returned` to `pedantic`

This moves the `semicolon_if_nothing_returned` lint to `pedantic` category.
I had done #7148, but on the master branch, and Github doesn't seem to let me change that, so here's another PR

changelog: Move [`semicolon_if_nothing_returned`] lint into `pedantic` category.
This commit is contained in:
bors 2021-05-25 13:53:37 +00:00
commit cd4abf93e0
70 changed files with 154 additions and 153 deletions

View File

@ -63,7 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for AssertionsOnConstants {
&format!("`assert!(false, {})` should probably be replaced", panic_message),
None,
&format!("use `panic!({})` or `unreachable!({})`", panic_message, panic_message),
)
);
};
if let Some(debug_assert_span) = is_expn_of(e.span, "debug_assert") {

View File

@ -273,7 +273,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
let attrs = cx.tcx.hir().attrs(item.hir_id());
if is_relevant_item(cx, item) {
check_attrs(cx, item.span, item.ident.name, attrs)
check_attrs(cx, item.span, item.ident.name, attrs);
}
match item.kind {
ItemKind::ExternCrate(..) | ItemKind::Use(..) => {
@ -343,13 +343,13 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) {
if is_relevant_impl(cx, item) {
check_attrs(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()))
check_attrs(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()));
}
}
fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx TraitItem<'_>) {
if is_relevant_trait(cx, item) {
check_attrs(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()))
check_attrs(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()));
}
}
}

View File

@ -115,9 +115,9 @@ impl<'tcx> LateLintPass<'tcx> for BitMask {
if let ExprKind::Binary(cmp, left, right) = &e.kind {
if cmp.node.is_comparison() {
if let Some(cmp_opt) = fetch_int_literal(cx, right) {
check_compare(cx, left, cmp.node, cmp_opt, e.span)
check_compare(cx, left, cmp.node, cmp_opt, e.span);
} else if let Some(cmp_val) = fetch_int_literal(cx, left) {
check_compare(cx, right, invert_cmp(cmp.node), cmp_val, e.span)
check_compare(cx, right, invert_cmp(cmp.node), cmp_val, e.span);
}
}
}
@ -171,7 +171,7 @@ fn check_compare(cx: &LateContext<'_>, bit_op: &Expr<'_>, cmp_op: BinOpKind, cmp
}
fetch_int_literal(cx, right)
.or_else(|| fetch_int_literal(cx, left))
.map_or((), |mask| check_bit_mask(cx, op.node, cmp_op, mask, cmp_value, span))
.map_or((), |mask| check_bit_mask(cx, op.node, cmp_op, mask, cmp_value, span));
}
}

View File

@ -66,7 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for NonminimalBool {
_: Span,
_: HirId,
) {
NonminimalBoolVisitor { cx }.visit_body(body)
NonminimalBoolVisitor { cx }.visit_body(body);
}
}
@ -184,7 +184,7 @@ impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> {
Term(n) => {
let terminal = self.terminals[n as usize];
if let Some(str) = simplify_not(self.cx, terminal) {
self.output.push_str(&str)
self.output.push_str(&str);
} else {
self.output.push('!');
let snip = snippet_opt(self.cx, terminal.span)?;
@ -452,7 +452,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NonminimalBoolVisitor<'a, 'tcx> {
}
match &e.kind {
ExprKind::Binary(binop, _, _) if binop.node == BinOpKind::Or || binop.node == BinOpKind::And => {
self.bool_expr(e)
self.bool_expr(e);
},
ExprKind::Unary(UnOp::Not, inner) => {
if self.cx.typeck_results().node_types()[inner.hir_id].is_bool() {

View File

@ -92,7 +92,7 @@ declare_lint_pass!(CollapsibleIf => [COLLAPSIBLE_IF, COLLAPSIBLE_ELSE_IF]);
impl EarlyLintPass for CollapsibleIf {
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) {
if !expr.span.from_expansion() {
check_if(cx, expr)
check_if(cx, expr);
}
}
}

View File

@ -120,7 +120,7 @@ impl<'tcx> LateLintPass<'tcx> for ComparisonChain {
"`if` chain can be rewritten with `match`",
None,
"consider rewriting the `if` chain to use `cmp` and `match`",
)
);
}
}

View File

@ -476,7 +476,7 @@ fn emit_branches_sharing_code_lint(
}
suggestions.push(("end", span, suggestion.to_string()));
add_expr_note = !cx.typeck_results().expr_ty(if_expr).is_unit()
add_expr_note = !cx.typeck_results().expr_ty(if_expr).is_unit();
}
let add_optional_msgs = |diag: &mut DiagnosticBuilder<'_>| {

View File

@ -181,9 +181,9 @@ impl<'a, 'tcx> Visitor<'tcx> for NumericFallbackVisitor<'a, 'tcx> {
match stmt.kind {
StmtKind::Local(local) => {
if local.ty.is_some() {
self.ty_bounds.push(TyBound::Any)
self.ty_bounds.push(TyBound::Any);
} else {
self.ty_bounds.push(TyBound::Nothing)
self.ty_bounds.push(TyBound::Nothing);
}
},

View File

@ -70,16 +70,16 @@ impl<'tcx> DoubleComparisons {
#[rustfmt::skip]
match (op, lkind, rkind) {
(BinOpKind::Or, BinOpKind::Eq, BinOpKind::Lt) | (BinOpKind::Or, BinOpKind::Lt, BinOpKind::Eq) => {
lint_double_comparison!(<=)
lint_double_comparison!(<=);
},
(BinOpKind::Or, BinOpKind::Eq, BinOpKind::Gt) | (BinOpKind::Or, BinOpKind::Gt, BinOpKind::Eq) => {
lint_double_comparison!(>=)
lint_double_comparison!(>=);
},
(BinOpKind::Or, BinOpKind::Lt, BinOpKind::Gt) | (BinOpKind::Or, BinOpKind::Gt, BinOpKind::Lt) => {
lint_double_comparison!(!=)
lint_double_comparison!(!=);
},
(BinOpKind::And, BinOpKind::Le, BinOpKind::Ge) | (BinOpKind::And, BinOpKind::Ge, BinOpKind::Le) => {
lint_double_comparison!(==)
lint_double_comparison!(==);
},
_ => (),
};

View File

@ -469,7 +469,7 @@ impl<'tcx> Visitor<'tcx> for InsertSearcher<'_, 'tcx> {
let mut is_map_used = self.is_map_used;
for arm in arms {
if let Some(Guard::If(guard) | Guard::IfLet(_, guard)) = arm.guard {
self.visit_non_tail_expr(guard)
self.visit_non_tail_expr(guard);
}
is_map_used |= self.visit_cond_arm(arm.body);
}

View File

@ -156,7 +156,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
vec![(left.span, lsnip), (right.span, rsnip)],
);
},
)
);
} else if lcpy
&& !rcpy
&& implements_trait(cx, lty, trait_id, &[cx.typeck_results().expr_ty(right).into()])
@ -175,7 +175,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
Applicability::MaybeIncorrect, // FIXME #2597
);
},
)
);
} else if !lcpy
&& rcpy
&& implements_trait(cx, cx.typeck_results().expr_ty(left), trait_id, &[rty.into()])
@ -194,7 +194,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
Applicability::MaybeIncorrect, // FIXME #2597
);
},
)
);
}
},
// &foo == bar
@ -218,7 +218,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
Applicability::MaybeIncorrect, // FIXME #2597
);
},
)
);
}
},
// foo == &bar
@ -236,7 +236,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
rsnip,
Applicability::MaybeIncorrect, // FIXME #2597
);
})
});
}
},
_ => {},

View File

@ -77,7 +77,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
for arg in args {
// skip `foo(macro!())`
if arg.span.ctxt() == expr.span.ctxt() {
check_closure(cx, arg)
check_closure(cx, arg);
}
}
},
@ -190,9 +190,10 @@ fn get_ufcs_type_name(cx: &LateContext<'_>, method_def_id: def_id::DefId, self_a
cx.tcx.impl_of_method(method_def_id).and_then(|_| {
//a type may implicitly implement other type's methods (e.g. Deref)
if match_types(expected_type_of_self, actual_type_of_self) {
return Some(get_type_name(cx, actual_type_of_self));
Some(get_type_name(cx, actual_type_of_self))
} else {
None
}
None
})
}

View File

@ -110,7 +110,7 @@ impl<'a, 'tcx> DivergenceVisitor<'a, 'tcx> {
self.visit_expr(e);
for arm in arms {
if let Some(Guard::If(if_expr)) = arm.guard {
self.visit_expr(if_expr)
self.visit_expr(if_expr);
}
// make sure top level arm expressions aren't linted
self.maybe_walk_expr(&*arm.body);

View File

@ -240,7 +240,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
}
},
Assign(target, ..) | AssignOp(_, target, _) | AddrOf(_, hir::Mutability::Mut, target) => {
self.mutates_static |= is_mutated_static(target)
self.mutates_static |= is_mutated_static(target);
},
_ => {},
}

View File

@ -63,6 +63,6 @@ pub(super) fn check_fn(cx: &LateContext<'_>, span: Span, body: &'tcx hir::Body<'
"this function has too many lines ({}/{})",
line_count, too_many_lines_threshold
),
)
);
}
}

View File

@ -102,7 +102,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
));
}
}
})
});
},
);
}

View File

@ -67,7 +67,7 @@ fn lint_break(cx: &LateContext<'_>, break_span: Span, expr_span: Span) {
"change `break` to `return` as shown",
format!("return {}", snip),
app,
)
);
}
#[derive(Clone, Copy, PartialEq, Eq)]

View File

@ -54,7 +54,7 @@ impl<'tcx> LateLintPass<'tcx> for InfiniteIter {
return;
},
};
span_lint(cx, lint, expr.span, msg)
span_lint(cx, lint, expr.span, msg);
}
}

View File

@ -177,7 +177,7 @@ fn upcast_comparison_bounds_err<'tcx>(
},
Rel::Eq | Rel::Ne => unreachable!(),
} {
err_upcast_comparison(cx, span, lhs, true)
err_upcast_comparison(cx, span, lhs, true);
} else if match rel {
Rel::Lt => {
if invert {
@ -195,7 +195,7 @@ fn upcast_comparison_bounds_err<'tcx>(
},
Rel::Eq | Rel::Ne => unreachable!(),
} {
err_upcast_comparison(cx, span, lhs, false)
err_upcast_comparison(cx, span, lhs, false);
}
}
}

View File

@ -380,9 +380,9 @@ fn check_cmp(cx: &LateContext<'_>, span: Span, method: &Expr<'_>, lit: &Expr<'_>
}
}
check_len(cx, span, method_path.ident.name, args, &lit.node, op, compare_to)
check_len(cx, span, method_path.ident.name, args, &lit.node, op, compare_to);
} else {
check_empty_expr(cx, span, method, lit, op)
check_empty_expr(cx, span, method, lit, op);
}
}

View File

@ -135,7 +135,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
None,
"consider using an underscore-prefixed named \
binding or dropping explicitly with `std::mem::drop`"
)
);
} else if init_ty.needs_drop(cx.tcx, cx.param_env) {
span_lint_and_help(
cx,
@ -145,7 +145,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
None,
"consider using an underscore-prefixed named \
binding or dropping explicitly with `std::mem::drop`"
)
);
} else if is_must_use_ty(cx, cx.typeck_results().expr_ty(init)) {
span_lint_and_help(
cx,
@ -154,7 +154,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
"non-binding let on an expression with `#[must_use]` type",
None,
"consider explicitly using expression value"
)
);
} else if is_must_use_func_call(cx, init) {
span_lint_and_help(
cx,
@ -163,7 +163,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
"non-binding let on a result of a `#[must_use]` function",
None,
"consider explicitly using function result"
)
);
}
}
}

View File

@ -1038,7 +1038,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(panic_unimplemented::UNIMPLEMENTED),
LintId::of(panic_unimplemented::UNREACHABLE),
LintId::of(pattern_type_mismatch::PATTERN_TYPE_MISMATCH),
LintId::of(semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED),
LintId::of(shadow::SHADOW_REUSE),
LintId::of(shadow::SHADOW_SAME),
LintId::of(strings::STRING_ADD),
@ -1129,6 +1128,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(ranges::RANGE_PLUS_ONE),
LintId::of(redundant_else::REDUNDANT_ELSE),
LintId::of(ref_option_ref::REF_OPTION_REF),
LintId::of(semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED),
LintId::of(shadow::SHADOW_UNRELATED),
LintId::of(strings::STRING_ADD_ASSIGN),
LintId::of(trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS),

View File

@ -205,7 +205,7 @@ fn could_use_elision<'tcx>(
output_visitor.visit_ty(ty);
}
for lt in named_generics {
input_visitor.visit_generic_param(lt)
input_visitor.visit_generic_param(lt);
}
if input_visitor.abort() || output_visitor.abort() {
@ -463,7 +463,7 @@ impl<'tcx> Visitor<'tcx> for LifetimeChecker {
// `'b` in `'a: 'b` is useless unless used elsewhere in
// a non-lifetime bound
if let GenericParamKind::Type { .. } = param.kind {
walk_generic_param(self, param)
walk_generic_param(self, param);
}
}
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {

View File

@ -231,7 +231,7 @@ impl EarlyLintPass for LiteralDigitGrouping {
}
if let ExprKind::Lit(ref lit) = expr.kind {
self.check_lit(cx, lit)
self.check_lit(cx, lit);
}
}
}
@ -294,7 +294,7 @@ impl LiteralDigitGrouping {
}
};
if should_warn {
warning_type.display(num_lit.format(), cx, lit.span)
warning_type.display(num_lit.format(), cx, lit.span);
}
}
}
@ -424,7 +424,7 @@ impl EarlyLintPass for DecimalLiteralRepresentation {
}
if let ExprKind::Lit(ref lit) = expr.kind {
self.check_lit(cx, lit)
self.check_lit(cx, lit);
}
}
}
@ -446,7 +446,7 @@ impl DecimalLiteralRepresentation {
let hex = format!("{:#X}", val);
let num_lit = NumericLiteral::new(&hex, num_lit.suffix, false);
let _ = Self::do_lint(num_lit.integer).map_err(|warning_type| {
warning_type.display(num_lit.format(), cx, lit.span)
warning_type.display(num_lit.format(), cx, lit.span);
});
}
}

View File

@ -43,7 +43,7 @@ pub(super) fn check(cx: &LateContext<'_>, self_arg: &Expr<'_>, arg: &Expr<'_>, m
"to write this more concisely, try",
format!("&{}{}", muta, object),
applicability,
)
);
}
/// Returns `true` if the type of expr is one that provides `IntoIterator` impls

View File

@ -88,10 +88,10 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate<'_, 'tcx> {
if let ty::BorrowKind::MutBorrow = bk {
if let PlaceBase::Local(id) = cmt.place.base {
if Some(id) == self.hir_id_low {
self.span_low = Some(self.cx.tcx.hir().span(diag_expr_id))
self.span_low = Some(self.cx.tcx.hir().span(diag_expr_id));
}
if Some(id) == self.hir_id_high {
self.span_high = Some(self.cx.tcx.hir().span(diag_expr_id))
self.span_high = Some(self.cx.tcx.hir().span(diag_expr_id));
}
}
}
@ -100,10 +100,10 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate<'_, 'tcx> {
fn mutate(&mut self, cmt: &PlaceWithHirId<'tcx>, diag_expr_id: HirId) {
if let PlaceBase::Local(id) = cmt.place.base {
if Some(id) == self.hir_id_low {
self.span_low = Some(self.cx.tcx.hir().span(diag_expr_id))
self.span_low = Some(self.cx.tcx.hir().span(diag_expr_id));
}
if Some(id) == self.hir_id_high {
self.span_high = Some(self.cx.tcx.hir().span(diag_expr_id))
self.span_high = Some(self.cx.tcx.hir().span(diag_expr_id));
}
}
}

View File

@ -35,7 +35,7 @@ pub(super) fn check<'tcx>(
"try using vec![{};SIZE] or {}.resize(NEW_SIZE, {})",
item_str, vec_str, item_str
),
)
);
}
if !matches!(pat.kind, PatKind::Wild) {

View File

@ -80,10 +80,10 @@ impl<'a, 'tcx> Visitor<'tcx> for IncrementVisitor<'a, 'tcx> {
}
},
ExprKind::Assign(lhs, _, _) if lhs.hir_id == expr.hir_id => {
*state = IncrementVisitorVarState::DontWarn
*state = IncrementVisitorVarState::DontWarn;
},
ExprKind::AddrOf(BorrowKind::Ref, mutability, _) if mutability == Mutability::Mut => {
*state = IncrementVisitorVarState::DontWarn
*state = IncrementVisitorVarState::DontWarn;
},
_ => (),
}
@ -207,7 +207,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
}
},
ExprKind::AddrOf(BorrowKind::Ref, mutability, _) if mutability == Mutability::Mut => {
self.state = InitializeVisitorState::DontWarn
self.state = InitializeVisitorState::DontWarn;
},
_ => (),
}
@ -292,7 +292,7 @@ impl<'tcx> Visitor<'tcx> for LoopNestVisitor {
return;
}
}
walk_pat(self, pat)
walk_pat(self, pat);
}
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {

View File

@ -212,9 +212,9 @@ impl<'tcx> LateLintPass<'tcx> for MacroUseImports {
let mut suggestions = vec![];
for ((root, span), path) in used {
if path.len() == 1 {
suggestions.push((span, format!("{}::{}", root, path[0])))
suggestions.push((span, format!("{}::{}", root, path[0])));
} else {
suggestions.push((span, format!("{}::{{{}}}", root, path.join(", "))))
suggestions.push((span, format!("{}::{{{}}}", root, path.join(", "))));
}
}
@ -231,7 +231,7 @@ impl<'tcx> LateLintPass<'tcx> for MacroUseImports {
"remove the attribute and import the macro directly, try",
help,
Applicability::MaybeIncorrect,
)
);
}
}
}

View File

@ -123,7 +123,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualStrip {
kind_word,
snippet(cx, pattern.span, "..")))]
.into_iter().chain(strippings.into_iter().map(|span| (span, "<stripped>".into()))),
)
);
});
}
}

View File

@ -125,7 +125,7 @@ fn lint_needless_cloning(cx: &LateContext<'_>, root: Span, receiver: Span) {
"remove the `map` call",
String::new(),
Applicability::MachineApplicable,
)
);
}
fn lint(cx: &LateContext<'_>, replace: Span, root: Span, copied: bool) {
@ -142,7 +142,7 @@ fn lint(cx: &LateContext<'_>, replace: Span, root: Span, copied: bool) {
snippet_with_applicability(cx, root, "..", &mut applicability)
),
applicability,
)
);
} else {
span_lint_and_sugg(
cx,
@ -155,6 +155,6 @@ fn lint(cx: &LateContext<'_>, replace: Span, root: Span, copied: bool) {
snippet_with_applicability(cx, root, "..", &mut applicability)
),
applicability,
)
);
}
}

View File

@ -1144,7 +1144,7 @@ fn check_wild_enum_match(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>])
"try this",
suggestions.join(" | "),
Applicability::MaybeIncorrect,
)
);
},
};
}
@ -1242,7 +1242,7 @@ fn check_match_as_ref(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>], exp
cast,
),
applicability,
)
);
}
}
}
@ -1494,7 +1494,7 @@ fn check_match_single_binding<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[A
"consider using the scrutinee and body instead",
sugg,
applicability,
)
);
} else {
span_lint_and_sugg(
cx,
@ -1747,7 +1747,7 @@ mod redundant_pattern_match {
match match_source {
MatchSource::Normal => find_sugg_for_match(cx, expr, op, arms),
MatchSource::IfLetDesugar { contains_else_clause } => {
find_sugg_for_if_let(cx, expr, op, &arms[0], "if", *contains_else_clause)
find_sugg_for_if_let(cx, expr, op, &arms[0], "if", *contains_else_clause);
},
MatchSource::WhileLetDesugar => find_sugg_for_if_let(cx, expr, op, &arms[0], "while", false),
_ => {},
@ -1876,7 +1876,7 @@ mod redundant_pattern_match {
{
self.res = true;
} else {
self.visit_expr(self_arg)
self.visit_expr(self_arg);
}
}
args.iter().for_each(|arg| self.visit_expr(arg));

View File

@ -135,7 +135,7 @@ pub(crate) trait BindInsteadOfMap {
.into_iter()
.map(|(span1, span2)| (span1, snippet(cx, span2, "_").into())),
),
)
);
});
true
}

View File

@ -41,5 +41,5 @@ pub fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, span: Span,
"try",
"copied".into(),
Applicability::MachineApplicable,
)
);
}

View File

@ -30,5 +30,5 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, arg
"try",
"filter_map".into(),
Applicability::MachineApplicable,
)
);
}

View File

@ -1951,7 +1951,7 @@ fn check_methods<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, msrv: Optio
if let Some((name, [recv, args @ ..], span)) = method_call!(expr) {
match (name, args) {
("add" | "offset" | "sub" | "wrapping_offset" | "wrapping_add" | "wrapping_sub", [recv, _]) => {
zst_offset::check(cx, expr, recv)
zst_offset::check(cx, expr, recv);
},
("and_then", [arg]) => {
let biom_option_linted = bind_instead_of_map::OptionAndThenSome::check(cx, expr, recv, arg);
@ -2012,7 +2012,7 @@ fn check_methods<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, msrv: Optio
("as_mut", []) => option_as_ref_deref::check(cx, expr, recv2, m_arg, true, msrv),
("as_ref", []) => option_as_ref_deref::check(cx, expr, recv2, m_arg, false, msrv),
("filter", [f_arg]) => {
filter_map::check(cx, expr, recv2, f_arg, span2, recv, m_arg, span, false)
filter_map::check(cx, expr, recv2, f_arg, span2, recv, m_arg, span, false);
},
("find", [f_arg]) => filter_map::check(cx, expr, recv2, f_arg, span2, recv, m_arg, span, true),
_ => {},
@ -2058,7 +2058,7 @@ fn check_methods<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, msrv: Optio
manual_saturating_arithmetic::check(cx, expr, lhs, rhs, u_arg, &arith["checked_".len()..]);
},
Some(("map", [m_recv, m_arg], span)) => {
option_map_unwrap_or::check(cx, expr, m_recv, m_arg, recv, u_arg, span)
option_map_unwrap_or::check(cx, expr, m_recv, m_arg, recv, u_arg, span);
},
_ => {},
},
@ -2073,7 +2073,7 @@ fn check_methods<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, msrv: Optio
fn check_is_some_is_none(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, is_some: bool) {
if let Some((name @ ("find" | "position" | "rposition"), [f_recv, arg], span)) = method_call!(recv) {
search_is_some::check(cx, expr, name, is_some, f_recv, arg, recv, span)
search_is_some::check(cx, expr, name, is_some, f_recv, arg, recv, span);
}
}

View File

@ -87,7 +87,7 @@ pub(super) fn check(
ast::LitKind::Bool(true) => check_fold_with_op(cx, expr, acc, fold_span, hir::BinOpKind::And, "all", true),
ast::LitKind::Int(0, _) => check_fold_with_op(cx, expr, acc, fold_span, hir::BinOpKind::Add, "sum", false),
ast::LitKind::Int(1, _) => {
check_fold_with_op(cx, expr, acc, fold_span, hir::BinOpKind::Mul, "product", false)
check_fold_with_op(cx, expr, acc, fold_span, hir::BinOpKind::Mul, "product", false);
},
_ => (),
}

View File

@ -310,7 +310,7 @@ impl EarlyLintPass for MiscEarlyLints {
if in_external_macro(cx.sess(), expr.span) {
return;
}
double_neg::check(cx, expr)
double_neg::check(cx, expr);
}
}
@ -334,15 +334,15 @@ impl MiscEarlyLints {
};
unseparated_literal_suffix::check(cx, lit, &lit_snip, suffix, "integer");
if lit_snip.starts_with("0x") {
mixed_case_hex_literals::check(cx, lit, suffix, &lit_snip)
mixed_case_hex_literals::check(cx, lit, suffix, &lit_snip);
} else if lit_snip.starts_with("0b") || lit_snip.starts_with("0o") {
/* nothing to do */
// nothing to do
} else if value != 0 && lit_snip.starts_with('0') {
zero_prefixed_literal::check(cx, lit, &lit_snip)
zero_prefixed_literal::check(cx, lit, &lit_snip);
}
} else if let LitKind::Float(_, LitFloatType::Suffixed(float_ty)) = lit.kind {
let suffix = float_ty.name_str();
unseparated_literal_suffix::check(cx, lit, &lit_snip, suffix, "float")
unseparated_literal_suffix::check(cx, lit, &lit_snip, suffix, "float");
}
}
}

View File

@ -48,7 +48,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryMutPassed {
let def_id = cx.typeck_results().type_dependent_def_id(e.hir_id).unwrap();
let substs = cx.typeck_results().node_substs(e.hir_id);
let method_type = cx.tcx.type_of(def_id).subst(cx.tcx, substs);
check_arguments(cx, arguments, method_type, &path.ident.as_str(), "method")
check_arguments(cx, arguments, method_type, &path.ident.as_str(), "method");
},
_ => (),
}

View File

@ -103,7 +103,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MutArgVisitor<'a, 'tcx> {
_ if !self.found => self.expr_span = Some(expr.span),
_ => return,
}
walk_expr(self, expr)
walk_expr(self, expr);
}
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {

View File

@ -121,7 +121,7 @@ impl EarlyLintPass for NeedlessArbitrarySelfType {
match &p.ty.kind {
TyKind::Path(None, path) => {
if let PatKind::Ident(BindingMode::ByValue(mutbl), _, _) = p.pat.kind {
check_param_inner(cx, path, p.span.to(p.ty.span), &Mode::Value, mutbl)
check_param_inner(cx, path, p.span.to(p.ty.span), &Mode::Value, mutbl);
}
},
TyKind::Rptr(lifetime, mut_ty) => {
@ -129,7 +129,7 @@ impl EarlyLintPass for NeedlessArbitrarySelfType {
if let TyKind::Path(None, path) = &mut_ty.ty.kind;
if let PatKind::Ident(BindingMode::ByValue(Mutability::Not), _, _) = p.pat.kind;
then {
check_param_inner(cx, path, p.span.to(p.ty.span), &Mode::Ref(*lifetime), mut_ty.mutbl)
check_param_inner(cx, path, p.span.to(p.ty.span), &Mode::Ref(*lifetime), mut_ty.mutbl);
}
}
},

View File

@ -82,7 +82,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessBool {
}
if is_else_clause(cx.tcx, e) {
snip = snip.blockify()
snip = snip.blockify();
}
span_lint_and_sugg(
@ -144,7 +144,7 @@ impl<'tcx> LateLintPass<'tcx> for BoolComparison {
|h: Sugg<'_>| !h,
"equality checks against false can be replaced by a negation",
));
check_comparison(cx, e, true_case, false_case, true_case, false_case, ignore_no_literal)
check_comparison(cx, e, true_case, false_case, true_case, false_case, ignore_no_literal);
},
BinOpKind::Ne => {
let true_case = Some((
@ -152,7 +152,7 @@ impl<'tcx> LateLintPass<'tcx> for BoolComparison {
"inequality checks against true can be replaced by a negation",
));
let false_case = Some((|h| h, "inequality checks against false are unnecessary"));
check_comparison(cx, e, true_case, false_case, true_case, false_case, ignore_no_literal)
check_comparison(cx, e, true_case, false_case, true_case, false_case, ignore_no_literal);
},
BinOpKind::Lt => check_comparison(
cx,
@ -251,22 +251,22 @@ fn check_comparison<'a, 'tcx>(
snippet_with_applicability(cx, expression_info.right_span, "..", &mut applicability)
),
applicability,
)
);
}
}
match (fetch_bool_expr(left_side), fetch_bool_expr(right_side)) {
(Bool(true), Other) => left_true.map_or((), |(h, m)| {
suggest_bool_comparison(cx, e, right_side, applicability, m, h)
suggest_bool_comparison(cx, e, right_side, applicability, m, h);
}),
(Other, Bool(true)) => right_true.map_or((), |(h, m)| {
suggest_bool_comparison(cx, e, left_side, applicability, m, h)
suggest_bool_comparison(cx, e, left_side, applicability, m, h);
}),
(Bool(false), Other) => left_false.map_or((), |(h, m)| {
suggest_bool_comparison(cx, e, right_side, applicability, m, h)
suggest_bool_comparison(cx, e, right_side, applicability, m, h);
}),
(Other, Bool(false)) => right_false.map_or((), |(h, m)| {
suggest_bool_comparison(cx, e, left_side, applicability, m, h)
suggest_bool_comparison(cx, e, left_side, applicability, m, h);
}),
(Other, Other) => no_literal.map_or((), |(h, m)| {
let left_side = Sugg::hir_with_applicability(cx, left_side, "..", &mut applicability);
@ -279,7 +279,7 @@ fn check_comparison<'a, 'tcx>(
"try simplifying it as shown",
h(left_side, right_side).to_string(),
applicability,
)
);
}),
_ => (),
}

View File

@ -199,7 +199,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessBorrow {
|diag| {
diag.multipart_suggestion("try this", replacements, app);
},
)
);
}
self.current_body = None;
}

View File

@ -142,10 +142,10 @@ impl<'tcx> Visitor<'tcx> for RetCollector {
match expr.kind {
ExprKind::Ret(..) => {
if self.loop_depth > 0 && !self.ret_in_loop {
self.ret_in_loop = true
self.ret_in_loop = true;
}
self.spans.push(expr.span)
self.spans.push(expr.span);
},
ExprKind::Loop(..) => {

View File

@ -84,7 +84,7 @@ impl<'tcx> LateLintPass<'tcx> for NoNegCompOpForPartialOrd {
types produces code that is hard to read and refactor, please \
consider using the `partial_cmp` method instead, to make it \
clear that the two values could be incomparable"
)
);
}
}
}

View File

@ -123,7 +123,7 @@ fn check_open_options(cx: &LateContext<'_>, options: &[(OpenOption, Argument)],
"the method `create` is called more than once",
);
} else {
create = true
create = true;
}
create_arg = create_arg || (arg == Argument::True);
},
@ -136,7 +136,7 @@ fn check_open_options(cx: &LateContext<'_>, options: &[(OpenOption, Argument)],
"the method `append` is called more than once",
);
} else {
append = true
append = true;
}
append_arg = append_arg || (arg == Argument::True);
},
@ -149,7 +149,7 @@ fn check_open_options(cx: &LateContext<'_>, options: &[(OpenOption, Argument)],
"the method `truncate` is called more than once",
);
} else {
truncate = true
truncate = true;
}
truncate_arg = truncate_arg || (arg == Argument::True);
},
@ -162,7 +162,7 @@ fn check_open_options(cx: &LateContext<'_>, options: &[(OpenOption, Argument)],
"the method `read` is called more than once",
);
} else {
read = true
read = true;
}
read_arg = read_arg || (arg == Argument::True);
},
@ -175,7 +175,7 @@ fn check_open_options(cx: &LateContext<'_>, options: &[(OpenOption, Argument)],
"the method `write` is called more than once",
);
} else {
write = true
write = true;
}
write_arg = write_arg || (arg == Argument::True);
},

View File

@ -88,7 +88,7 @@ impl QuestionMark {
"replace it with",
replacement_str,
applicability,
)
);
}
}
}
@ -129,7 +129,7 @@ impl QuestionMark {
"replace it with",
replacement,
applicability,
)
);
}
}
}

View File

@ -57,7 +57,7 @@ impl<'ast> ast_visit::Visitor<'ast> for ReturnVisitor {
self.found_return = true;
}
ast_visit::walk_expr(self, ex)
ast_visit::walk_expr(self, ex);
}
}

View File

@ -59,7 +59,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantPubCrate {
Applicability::MachineApplicable,
);
},
)
);
}
}
}

View File

@ -139,7 +139,7 @@ impl<'tcx> LateLintPass<'tcx> for Return {
} else {
RetReplacement::Empty
};
check_final_expr(cx, &body.value, Some(body.value.span), replacement)
check_final_expr(cx, &body.value, Some(body.value.span), replacement);
},
FnKind::ItemFn(..) | FnKind::Method(..) => {
if let ExprKind::Block(block, _) = body.value.kind {
@ -241,7 +241,7 @@ fn emit_return_lint(cx: &LateContext<'_>, ret_span: Span, inner_span: Option<Spa
if let Some(snippet) = snippet_opt(cx, inner_span) {
diag.span_suggestion(ret_span, "remove `return`", snippet, Applicability::MachineApplicable);
}
})
});
},
None => match replacement {
RetReplacement::Empty => {

View File

@ -8,11 +8,11 @@ use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
declare_clippy_lint! {
/// **What it does:** Looks for blocks of expressions and fires if the last expression returns `()`
/// but is not followed by a semicolon.
/// **What it does:** Looks for blocks of expressions and fires if the last expression returns
/// `()` but is not followed by a semicolon.
///
/// **Why is this bad?** The semicolon might be optional but when
/// extending the block with new code, it doesn't require a change in previous last line.
/// **Why is this bad?** The semicolon might be optional but when extending the block with new
/// code, it doesn't require a change in previous last line.
///
/// **Known problems:** None.
///
@ -30,7 +30,7 @@ declare_clippy_lint! {
/// }
/// ```
pub SEMICOLON_IF_NOTHING_RETURNED,
restriction,
pedantic,
"add a semicolon if nothing is returned"
}

View File

@ -120,7 +120,7 @@ fn check_fn<'tcx>(cx: &LateContext<'tcx>, decl: &'tcx FnDecl<'_>, body: &'tcx Bo
let mut bindings = Vec::with_capacity(decl.inputs.len());
for arg in iter_input_pats(decl, body) {
if let PatKind::Binding(.., ident, _) = arg.pat.kind {
bindings.push((ident.name, ident.span))
bindings.push((ident.name, ident.span));
}
}
check_expr(cx, &body.value, &mut bindings);
@ -156,7 +156,7 @@ fn check_local<'tcx>(cx: &LateContext<'tcx>, local: &'tcx Local<'_>, bindings: &
..
} = *local;
if let Some(t) = *ty {
check_ty(cx, t, bindings)
check_ty(cx, t, bindings);
}
if let Some(o) = *init {
check_expr(cx, o, bindings);
@ -324,14 +324,14 @@ fn check_expr<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, bindings: &mut
}
match expr.kind {
ExprKind::Unary(_, e) | ExprKind::Field(e, _) | ExprKind::AddrOf(_, _, e) | ExprKind::Box(e) => {
check_expr(cx, e, bindings)
check_expr(cx, e, bindings);
},
ExprKind::Block(block, _) | ExprKind::Loop(block, ..) => check_block(cx, block, bindings),
// ExprKind::Call
// ExprKind::MethodCall
ExprKind::Array(v) | ExprKind::Tup(v) => {
for e in v {
check_expr(cx, e, bindings)
check_expr(cx, e, bindings);
}
},
ExprKind::If(cond, then, ref otherwise) => {
@ -374,7 +374,7 @@ fn check_ty<'tcx>(cx: &LateContext<'tcx>, ty: &'tcx Ty<'_>, bindings: &mut Vec<(
TyKind::Ptr(MutTy { ty: mty, .. }) | TyKind::Rptr(_, MutTy { ty: mty, .. }) => check_ty(cx, mty, bindings),
TyKind::Tup(tup) => {
for t in tup {
check_ty(cx, t, bindings)
check_ty(cx, t, bindings);
}
},
TyKind::Typeof(ref anon_const) => check_expr(cx, &cx.tcx.hir().body(anon_const.body).value, bindings),

View File

@ -158,7 +158,7 @@ impl SlowVectorInit {
) {
match initialization {
InitializationType::Extend(e) | InitializationType::Resize(e) => {
Self::emit_lint(cx, e, vec_alloc, "slow zero-filling initialization")
Self::emit_lint(cx, e, vec_alloc, "slow zero-filling initialization");
},
};
}
@ -290,7 +290,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VectorInitializationVisitor<'a, 'tcx> {
fn visit_block(&mut self, block: &'tcx Block<'_>) {
if self.initialization_found {
if let Some(s) = block.stmts.get(0) {
self.visit_stmt(s)
self.visit_stmt(s);
}
self.initialization_found = false;

View File

@ -266,7 +266,7 @@ fn emit_suggestion(cx: &EarlyContext<'_>, span: Span, sugg: String, applicabilit
"did you mean",
sugg,
applicability,
)
);
}
fn ident_swap_sugg(
@ -475,7 +475,7 @@ impl Add for IdentLocation {
impl AddAssign for IdentLocation {
fn add_assign(&mut self, other: Self) {
*self = *self + other
*self = *self + other;
}
}
@ -506,7 +506,7 @@ impl Add for IdentDifference {
impl AddAssign for IdentDifference {
fn add_assign(&mut self, other: Self) {
*self = *self + other
*self = *self + other;
}
}

View File

@ -306,7 +306,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
fn check_trait_item(&mut self, cx: &LateContext<'_>, item: &TraitItem<'_>) {
match item.kind {
TraitItemKind::Const(ty, _) | TraitItemKind::Type(_, Some(ty)) => {
self.check_ty(cx, ty, CheckTyContext::default())
self.check_ty(cx, ty, CheckTyContext::default());
},
TraitItemKind::Fn(ref sig, _) => self.check_fn_decl(cx, sig.decl, CheckTyContext::default()),
TraitItemKind::Type(..) => (),
@ -433,7 +433,7 @@ impl Types {
},
TyKind::Slice(ty) | TyKind::Array(ty, _) | TyKind::Ptr(MutTy { ty, .. }) => {
context.is_nested_call = true;
self.check_ty(cx, ty, context)
self.check_ty(cx, ty, context);
},
TyKind::Tup(tys) => {
context.is_nested_call = true;

View File

@ -71,7 +71,7 @@ impl LateLintPass<'_> for Unicode {
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &'_ Expr<'_>) {
if let ExprKind::Lit(ref lit) = expr.kind {
if let LitKind::Str(_, _) = lit.node {
check_str(cx, lit.span, expr.hir_id)
check_str(cx, lit.span, expr.hir_id);
}
}
}
@ -82,7 +82,7 @@ fn escape<T: Iterator<Item = char>>(s: T) -> String {
for c in s {
if c as u32 > 0x7F {
for d in c.escape_unicode() {
result.push(d)
result.push(d);
}
} else {
result.push(c);

View File

@ -92,7 +92,7 @@ fn check_ident(cx: &EarlyContext<'_>, ident: &Ident, be_aggressive: bool) {
"consider making the acronym lowercase, except the initial letter",
corrected,
Applicability::MaybeIncorrect,
)
);
}
}

View File

@ -356,7 +356,7 @@ impl<'tcx> Visitor<'tcx> for SkipTyCollector {
fn visit_ty(&mut self, hir_ty: &hir::Ty<'_>) {
self.types_to_skip.push(hir_ty.hir_id);
walk_ty(self, hir_ty)
walk_ty(self, hir_ty);
}
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
@ -385,7 +385,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LintTyCollector<'a, 'tcx> {
}
}
walk_ty(self, hir_ty)
walk_ty(self, hir_ty);
}
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {

View File

@ -292,7 +292,7 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
LitKind::Str(ref text, _) => {
let str_pat = self.next("s");
println!(" if let LitKind::Str(ref {}, _) = {}.node;", str_pat, lit_pat);
println!(" if {}.as_str() == {:?}", str_pat, &*text.as_str())
println!(" if {}.as_str() == {:?}", str_pat, &*text.as_str());
},
}
},

View File

@ -1100,7 +1100,7 @@ impl<'tcx> LateLintPass<'tcx> for IfChainStyle {
IF_CHAIN_STYLE,
if_chain_local_span(cx, local, if_chain_span),
"`let` expression should be inside `then { .. }`",
)
);
}
}
@ -1141,7 +1141,7 @@ impl<'tcx> LateLintPass<'tcx> for IfChainStyle {
if is_first_if_chain_expr(cx, expr.hir_id, if_chain_span)
&& is_if_chain_then(then_block.stmts, then_block.expr, if_chain_span)
{
span_lint(cx, IF_CHAIN_STYLE, expr.span, "`if_chain!` only has one `if`")
span_lint(cx, IF_CHAIN_STYLE, expr.span, "`if_chain!` only has one `if`");
}
}
}

View File

@ -818,7 +818,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for IsMultiSpanScanner<'a, 'hir> {
.any(|func_path| match_function_call(self.cx, fn_expr, func_path).is_some());
if found_function {
// These functions are all multi part suggestions
self.add_single_span_suggestion()
self.add_single_span_suggestion();
}
},
ExprKind::MethodCall(path, _path_span, arg, _arg_span) => {

View File

@ -54,7 +54,7 @@ impl<'tcx> LateLintPass<'tcx> for VerboseFileReads {
"use of `File::read_to_string`",
None,
"consider using `fs::read_to_string` instead",
)
);
}
}
}

View File

@ -300,7 +300,7 @@ impl EarlyLintPass for Write {
Applicability::MachineApplicable,
);
},
)
);
}
}
} else if mac.path == sym!(writeln) {

View File

@ -115,7 +115,7 @@ fn parse_attrs<F: FnMut(u64)>(sess: &Session, attrs: &[ast::Attribute], name: &'
for attr in get_attr(sess, attrs, name) {
if let Some(ref value) = attr.value_str() {
if let Ok(value) = FromStr::from_str(&value.as_str()) {
f(value)
f(value);
} else {
sess.span_err(attr.span, "not a number");
}

View File

@ -223,7 +223,7 @@ pub fn multispan_sugg<I>(diag: &mut DiagnosticBuilder<'_>, help_msg: &str, sugg:
where
I: IntoIterator<Item = (Span, String)>,
{
multispan_sugg_with_applicability(diag, help_msg, Applicability::Unspecified, sugg)
multispan_sugg_with_applicability(diag, help_msg, Applicability::Unspecified, sugg);
}
/// Create a suggestion made from several `span → replacement`.

View File

@ -810,7 +810,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
self.hash_name(f.ident.name);
self.hash_pat(f.pat);
}
e.hash(&mut self.s)
e.hash(&mut self.s);
},
PatKind::Tuple(pats, e) => {
for pat in pats {

View File

@ -667,7 +667,7 @@ pub fn method_chain_args<'a>(expr: &'a Expr<'_>, methods: &[&str]) -> Option<Vec
return None;
}
matched.push(args); // build up `matched` backwards
current = &args[0] // go to parent expression
current = &args[0]; // go to parent expression
} else {
return None;
}
@ -1094,9 +1094,9 @@ pub fn is_refutable(cx: &LateContext<'_>, pat: &Pat<'_>) -> bool {
/// the function once on the given pattern.
pub fn recurse_or_patterns<'tcx, F: FnMut(&'tcx Pat<'tcx>)>(pat: &'tcx Pat<'tcx>, mut f: F) {
if let PatKind::Or(pats) = pat.kind {
pats.iter().copied().for_each(f)
pats.iter().copied().for_each(f);
} else {
f(pat)
f(pat);
}
}

View File

@ -684,7 +684,7 @@ impl<T: LintContext> DiagnosticBuilderExt<T> for rustc_errors::DiagnosticBuilder
if let Some(non_whitespace_offset) = non_whitespace_offset {
remove_span = remove_span
.with_hi(remove_span.hi() + BytePos(non_whitespace_offset.try_into().expect("offset too large")))
.with_hi(remove_span.hi() + BytePos(non_whitespace_offset.try_into().expect("offset too large")));
}
}

View File

@ -59,7 +59,7 @@ impl<'tcx> MutVarsDelegate {
//FIXME: This causes false negatives. We can't get the `NodeId` from
//`Categorization::Upvar(_)`. So we search for any `Upvar`s in the
//`while`-body, not just the ones in the condition.
self.skip = true
self.skip = true;
},
_ => {},
}
@ -71,12 +71,12 @@ impl<'tcx> Delegate<'tcx> for MutVarsDelegate {
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, bk: ty::BorrowKind) {
if let ty::BorrowKind::MutBorrow = bk {
self.update(cmt)
self.update(cmt);
}
}
fn mutate(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId) {
self.update(cmt)
self.update(cmt);
}
fn fake_read(&mut self, _: rustc_typeck::expr_use_visitor::Place<'tcx>, _: FakeReadCause, _: HirId) {}

View File

@ -87,7 +87,7 @@ where
}
fn visit_stmt(&mut self, stmt: &'hir hir::Stmt<'_>) {
intravisit::walk_stmt(&mut *self.inside_stmt(true), stmt)
intravisit::walk_stmt(&mut *self.inside_stmt(true), stmt);
}
fn visit_expr(&mut self, expr: &'hir hir::Expr<'_>) {
@ -219,7 +219,7 @@ pub fn visit_break_exprs<'tcx>(
fn visit_expr(&mut self, e: &'tcx Expr<'_>) {
if let ExprKind::Break(dest, sub_expr) = e.kind {
self.0(e, dest, sub_expr)
self.0(e, dest, sub_expr);
}
walk_expr(self, e);
}
@ -251,7 +251,7 @@ pub fn is_res_used(cx: &LateContext<'_>, res: Res, body: BodyId) -> bool {
self.found = true;
}
} else {
walk_expr(self, e)
walk_expr(self, e);
}
}
}