Skip to content

Commit cd4abf9

Browse files
committed
Auto merge of rust-lang#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 rust-lang#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.
2 parents a248648 + bcebea6 commit cd4abf9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+154
-153
lines changed

clippy_lints/src/assertions_on_constants.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for AssertionsOnConstants {
6363
&format!("`assert!(false, {})` should probably be replaced", panic_message),
6464
None,
6565
&format!("use `panic!({})` or `unreachable!({})`", panic_message, panic_message),
66-
)
66+
);
6767
};
6868

6969
if let Some(debug_assert_span) = is_expn_of(e.span, "debug_assert") {

clippy_lints/src/attrs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
273273
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
274274
let attrs = cx.tcx.hir().attrs(item.hir_id());
275275
if is_relevant_item(cx, item) {
276-
check_attrs(cx, item.span, item.ident.name, attrs)
276+
check_attrs(cx, item.span, item.ident.name, attrs);
277277
}
278278
match item.kind {
279279
ItemKind::ExternCrate(..) | ItemKind::Use(..) => {
@@ -343,13 +343,13 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
343343

344344
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) {
345345
if is_relevant_impl(cx, item) {
346-
check_attrs(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()))
346+
check_attrs(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()));
347347
}
348348
}
349349

350350
fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx TraitItem<'_>) {
351351
if is_relevant_trait(cx, item) {
352-
check_attrs(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()))
352+
check_attrs(cx, item.span, item.ident.name, cx.tcx.hir().attrs(item.hir_id()));
353353
}
354354
}
355355
}

clippy_lints/src/bit_mask.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ impl<'tcx> LateLintPass<'tcx> for BitMask {
115115
if let ExprKind::Binary(cmp, left, right) = &e.kind {
116116
if cmp.node.is_comparison() {
117117
if let Some(cmp_opt) = fetch_int_literal(cx, right) {
118-
check_compare(cx, left, cmp.node, cmp_opt, e.span)
118+
check_compare(cx, left, cmp.node, cmp_opt, e.span);
119119
} else if let Some(cmp_val) = fetch_int_literal(cx, left) {
120-
check_compare(cx, right, invert_cmp(cmp.node), cmp_val, e.span)
120+
check_compare(cx, right, invert_cmp(cmp.node), cmp_val, e.span);
121121
}
122122
}
123123
}
@@ -171,7 +171,7 @@ fn check_compare(cx: &LateContext<'_>, bit_op: &Expr<'_>, cmp_op: BinOpKind, cmp
171171
}
172172
fetch_int_literal(cx, right)
173173
.or_else(|| fetch_int_literal(cx, left))
174-
.map_or((), |mask| check_bit_mask(cx, op.node, cmp_op, mask, cmp_value, span))
174+
.map_or((), |mask| check_bit_mask(cx, op.node, cmp_op, mask, cmp_value, span));
175175
}
176176
}
177177

clippy_lints/src/booleans.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for NonminimalBool {
6666
_: Span,
6767
_: HirId,
6868
) {
69-
NonminimalBoolVisitor { cx }.visit_body(body)
69+
NonminimalBoolVisitor { cx }.visit_body(body);
7070
}
7171
}
7272

@@ -184,7 +184,7 @@ impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> {
184184
Term(n) => {
185185
let terminal = self.terminals[n as usize];
186186
if let Some(str) = simplify_not(self.cx, terminal) {
187-
self.output.push_str(&str)
187+
self.output.push_str(&str);
188188
} else {
189189
self.output.push('!');
190190
let snip = snippet_opt(self.cx, terminal.span)?;
@@ -452,7 +452,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NonminimalBoolVisitor<'a, 'tcx> {
452452
}
453453
match &e.kind {
454454
ExprKind::Binary(binop, _, _) if binop.node == BinOpKind::Or || binop.node == BinOpKind::And => {
455-
self.bool_expr(e)
455+
self.bool_expr(e);
456456
},
457457
ExprKind::Unary(UnOp::Not, inner) => {
458458
if self.cx.typeck_results().node_types()[inner.hir_id].is_bool() {

clippy_lints/src/collapsible_if.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ declare_lint_pass!(CollapsibleIf => [COLLAPSIBLE_IF, COLLAPSIBLE_ELSE_IF]);
9292
impl EarlyLintPass for CollapsibleIf {
9393
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) {
9494
if !expr.span.from_expansion() {
95-
check_if(cx, expr)
95+
check_if(cx, expr);
9696
}
9797
}
9898
}

clippy_lints/src/comparison_chain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl<'tcx> LateLintPass<'tcx> for ComparisonChain {
120120
"`if` chain can be rewritten with `match`",
121121
None,
122122
"consider rewriting the `if` chain to use `cmp` and `match`",
123-
)
123+
);
124124
}
125125
}
126126

clippy_lints/src/copies.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ fn emit_branches_sharing_code_lint(
476476
}
477477

478478
suggestions.push(("end", span, suggestion.to_string()));
479-
add_expr_note = !cx.typeck_results().expr_ty(if_expr).is_unit()
479+
add_expr_note = !cx.typeck_results().expr_ty(if_expr).is_unit();
480480
}
481481

482482
let add_optional_msgs = |diag: &mut DiagnosticBuilder<'_>| {

clippy_lints/src/default_numeric_fallback.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ impl<'a, 'tcx> Visitor<'tcx> for NumericFallbackVisitor<'a, 'tcx> {
181181
match stmt.kind {
182182
StmtKind::Local(local) => {
183183
if local.ty.is_some() {
184-
self.ty_bounds.push(TyBound::Any)
184+
self.ty_bounds.push(TyBound::Any);
185185
} else {
186-
self.ty_bounds.push(TyBound::Nothing)
186+
self.ty_bounds.push(TyBound::Nothing);
187187
}
188188
},
189189

clippy_lints/src/double_comparison.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ impl<'tcx> DoubleComparisons {
7070
#[rustfmt::skip]
7171
match (op, lkind, rkind) {
7272
(BinOpKind::Or, BinOpKind::Eq, BinOpKind::Lt) | (BinOpKind::Or, BinOpKind::Lt, BinOpKind::Eq) => {
73-
lint_double_comparison!(<=)
73+
lint_double_comparison!(<=);
7474
},
7575
(BinOpKind::Or, BinOpKind::Eq, BinOpKind::Gt) | (BinOpKind::Or, BinOpKind::Gt, BinOpKind::Eq) => {
76-
lint_double_comparison!(>=)
76+
lint_double_comparison!(>=);
7777
},
7878
(BinOpKind::Or, BinOpKind::Lt, BinOpKind::Gt) | (BinOpKind::Or, BinOpKind::Gt, BinOpKind::Lt) => {
79-
lint_double_comparison!(!=)
79+
lint_double_comparison!(!=);
8080
},
8181
(BinOpKind::And, BinOpKind::Le, BinOpKind::Ge) | (BinOpKind::And, BinOpKind::Ge, BinOpKind::Le) => {
82-
lint_double_comparison!(==)
82+
lint_double_comparison!(==);
8383
},
8484
_ => (),
8585
};

clippy_lints/src/entry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ impl<'tcx> Visitor<'tcx> for InsertSearcher<'_, 'tcx> {
469469
let mut is_map_used = self.is_map_used;
470470
for arm in arms {
471471
if let Some(Guard::If(guard) | Guard::IfLet(_, guard)) = arm.guard {
472-
self.visit_non_tail_expr(guard)
472+
self.visit_non_tail_expr(guard);
473473
}
474474
is_map_used |= self.visit_cond_arm(arm.body);
475475
}

clippy_lints/src/eq_op.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
156156
vec![(left.span, lsnip), (right.span, rsnip)],
157157
);
158158
},
159-
)
159+
);
160160
} else if lcpy
161161
&& !rcpy
162162
&& implements_trait(cx, lty, trait_id, &[cx.typeck_results().expr_ty(right).into()])
@@ -175,7 +175,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
175175
Applicability::MaybeIncorrect, // FIXME #2597
176176
);
177177
},
178-
)
178+
);
179179
} else if !lcpy
180180
&& rcpy
181181
&& implements_trait(cx, cx.typeck_results().expr_ty(left), trait_id, &[rty.into()])
@@ -194,7 +194,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
194194
Applicability::MaybeIncorrect, // FIXME #2597
195195
);
196196
},
197-
)
197+
);
198198
}
199199
},
200200
// &foo == bar
@@ -218,7 +218,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
218218
Applicability::MaybeIncorrect, // FIXME #2597
219219
);
220220
},
221-
)
221+
);
222222
}
223223
},
224224
// foo == &bar
@@ -236,7 +236,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
236236
rsnip,
237237
Applicability::MaybeIncorrect, // FIXME #2597
238238
);
239-
})
239+
});
240240
}
241241
},
242242
_ => {},

clippy_lints/src/eta_reduction.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
7777
for arg in args {
7878
// skip `foo(macro!())`
7979
if arg.span.ctxt() == expr.span.ctxt() {
80-
check_closure(cx, arg)
80+
check_closure(cx, arg);
8181
}
8282
}
8383
},
@@ -190,9 +190,10 @@ fn get_ufcs_type_name(cx: &LateContext<'_>, method_def_id: def_id::DefId, self_a
190190
cx.tcx.impl_of_method(method_def_id).and_then(|_| {
191191
//a type may implicitly implement other type's methods (e.g. Deref)
192192
if match_types(expected_type_of_self, actual_type_of_self) {
193-
return Some(get_type_name(cx, actual_type_of_self));
193+
Some(get_type_name(cx, actual_type_of_self))
194+
} else {
195+
None
194196
}
195-
None
196197
})
197198
}
198199

clippy_lints/src/eval_order_dependence.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<'a, 'tcx> DivergenceVisitor<'a, 'tcx> {
110110
self.visit_expr(e);
111111
for arm in arms {
112112
if let Some(Guard::If(if_expr)) = arm.guard {
113-
self.visit_expr(if_expr)
113+
self.visit_expr(if_expr);
114114
}
115115
// make sure top level arm expressions aren't linted
116116
self.maybe_walk_expr(&*arm.body);

clippy_lints/src/functions/must_use.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
240240
}
241241
},
242242
Assign(target, ..) | AssignOp(_, target, _) | AddrOf(_, hir::Mutability::Mut, target) => {
243-
self.mutates_static |= is_mutated_static(target)
243+
self.mutates_static |= is_mutated_static(target);
244244
},
245245
_ => {},
246246
}

clippy_lints/src/functions/too_many_lines.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ pub(super) fn check_fn(cx: &LateContext<'_>, span: Span, body: &'tcx hir::Body<'
6363
"this function has too many lines ({}/{})",
6464
line_count, too_many_lines_threshold
6565
),
66-
)
66+
);
6767
}
6868
}

clippy_lints/src/future_not_send.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
102102
));
103103
}
104104
}
105-
})
105+
});
106106
},
107107
);
108108
}

clippy_lints/src/implicit_return.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn lint_break(cx: &LateContext<'_>, break_span: Span, expr_span: Span) {
6767
"change `break` to `return` as shown",
6868
format!("return {}", snip),
6969
app,
70-
)
70+
);
7171
}
7272

7373
#[derive(Clone, Copy, PartialEq, Eq)]

clippy_lints/src/infinite_iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<'tcx> LateLintPass<'tcx> for InfiniteIter {
5454
return;
5555
},
5656
};
57-
span_lint(cx, lint, expr.span, msg)
57+
span_lint(cx, lint, expr.span, msg);
5858
}
5959
}
6060

clippy_lints/src/invalid_upcast_comparisons.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ fn upcast_comparison_bounds_err<'tcx>(
177177
},
178178
Rel::Eq | Rel::Ne => unreachable!(),
179179
} {
180-
err_upcast_comparison(cx, span, lhs, true)
180+
err_upcast_comparison(cx, span, lhs, true);
181181
} else if match rel {
182182
Rel::Lt => {
183183
if invert {
@@ -195,7 +195,7 @@ fn upcast_comparison_bounds_err<'tcx>(
195195
},
196196
Rel::Eq | Rel::Ne => unreachable!(),
197197
} {
198-
err_upcast_comparison(cx, span, lhs, false)
198+
err_upcast_comparison(cx, span, lhs, false);
199199
}
200200
}
201201
}

clippy_lints/src/len_zero.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,9 @@ fn check_cmp(cx: &LateContext<'_>, span: Span, method: &Expr<'_>, lit: &Expr<'_>
380380
}
381381
}
382382

383-
check_len(cx, span, method_path.ident.name, args, &lit.node, op, compare_to)
383+
check_len(cx, span, method_path.ident.name, args, &lit.node, op, compare_to);
384384
} else {
385-
check_empty_expr(cx, span, method, lit, op)
385+
check_empty_expr(cx, span, method, lit, op);
386386
}
387387
}
388388

clippy_lints/src/let_underscore.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
135135
None,
136136
"consider using an underscore-prefixed named \
137137
binding or dropping explicitly with `std::mem::drop`"
138-
)
138+
);
139139
} else if init_ty.needs_drop(cx.tcx, cx.param_env) {
140140
span_lint_and_help(
141141
cx,
@@ -145,7 +145,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
145145
None,
146146
"consider using an underscore-prefixed named \
147147
binding or dropping explicitly with `std::mem::drop`"
148-
)
148+
);
149149
} else if is_must_use_ty(cx, cx.typeck_results().expr_ty(init)) {
150150
span_lint_and_help(
151151
cx,
@@ -154,7 +154,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
154154
"non-binding let on an expression with `#[must_use]` type",
155155
None,
156156
"consider explicitly using expression value"
157-
)
157+
);
158158
} else if is_must_use_func_call(cx, init) {
159159
span_lint_and_help(
160160
cx,
@@ -163,7 +163,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
163163
"non-binding let on a result of a `#[must_use]` function",
164164
None,
165165
"consider explicitly using function result"
166-
)
166+
);
167167
}
168168
}
169169
}

clippy_lints/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10381038
LintId::of(panic_unimplemented::UNIMPLEMENTED),
10391039
LintId::of(panic_unimplemented::UNREACHABLE),
10401040
LintId::of(pattern_type_mismatch::PATTERN_TYPE_MISMATCH),
1041-
LintId::of(semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED),
10421041
LintId::of(shadow::SHADOW_REUSE),
10431042
LintId::of(shadow::SHADOW_SAME),
10441043
LintId::of(strings::STRING_ADD),
@@ -1129,6 +1128,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11291128
LintId::of(ranges::RANGE_PLUS_ONE),
11301129
LintId::of(redundant_else::REDUNDANT_ELSE),
11311130
LintId::of(ref_option_ref::REF_OPTION_REF),
1131+
LintId::of(semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED),
11321132
LintId::of(shadow::SHADOW_UNRELATED),
11331133
LintId::of(strings::STRING_ADD_ASSIGN),
11341134
LintId::of(trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS),

clippy_lints/src/lifetimes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ fn could_use_elision<'tcx>(
205205
output_visitor.visit_ty(ty);
206206
}
207207
for lt in named_generics {
208-
input_visitor.visit_generic_param(lt)
208+
input_visitor.visit_generic_param(lt);
209209
}
210210

211211
if input_visitor.abort() || output_visitor.abort() {
@@ -463,7 +463,7 @@ impl<'tcx> Visitor<'tcx> for LifetimeChecker {
463463
// `'b` in `'a: 'b` is useless unless used elsewhere in
464464
// a non-lifetime bound
465465
if let GenericParamKind::Type { .. } = param.kind {
466-
walk_generic_param(self, param)
466+
walk_generic_param(self, param);
467467
}
468468
}
469469
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {

0 commit comments

Comments
 (0)