Skip to content

Commit d7b5cbf

Browse files
committed
Auto merge of #9007 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 9edd641 + 280797e commit d7b5cbf

Some content is hidden

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

66 files changed

+208
-192
lines changed

clippy_lints/src/almost_complete_letter_range.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn check_range(cx: &EarlyContext<'_>, span: Span, start: &Expr, end: &Expr, sugg
9090
diag.span_suggestion(
9191
span,
9292
"use an inclusive range",
93-
sugg.to_owned(),
93+
sugg,
9494
Applicability::MaybeIncorrect,
9595
);
9696
}

clippy_lints/src/as_underscore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for AsUnderscore {
6363
diag.span_suggestion(
6464
ty.span,
6565
"consider giving the type explicitly",
66-
format!("{}", ty_resolved),
66+
ty_resolved,
6767
Applicability::MachineApplicable,
6868
);
6969
}

clippy_lints/src/attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
340340
for lint in lint_list {
341341
match item.kind {
342342
ItemKind::Use(..) => {
343-
if is_word(lint, sym!(unused_imports))
343+
if is_word(lint, sym::unused_imports)
344344
|| is_word(lint, sym::deprecated)
345345
|| is_word(lint, sym!(unreachable_pub))
346346
|| is_word(lint, sym!(unused))
@@ -355,7 +355,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
355355
}
356356
},
357357
ItemKind::ExternCrate(..) => {
358-
if is_word(lint, sym!(unused_imports)) && skip_unused_imports {
358+
if is_word(lint, sym::unused_imports) && skip_unused_imports {
359359
return;
360360
}
361361
if is_word(lint, sym!(unused_extern_crates)) {

clippy_lints/src/blocks_in_if_conditions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct ExVisitor<'a, 'tcx> {
5151

5252
impl<'a, 'tcx> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
5353
fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) {
54-
if let ExprKind::Closure(_, _, eid, _, _) = expr.kind {
54+
if let ExprKind::Closure { body, .. } = expr.kind {
5555
// do not lint if the closure is called using an iterator (see #1141)
5656
if_chain! {
5757
if let Some(parent) = get_parent_expr(self.cx, expr);
@@ -64,7 +64,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
6464
}
6565
}
6666

67-
let body = self.cx.tcx.hir().body(eid);
67+
let body = self.cx.tcx.hir().body(body);
6868
let ex = &body.value;
6969
if let ExprKind::Block(block, _) = ex.kind {
7070
if !body.value.span.from_expansion() && !block.stmts.is_empty() {

clippy_lints/src/bytecount.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount {
5151
if count.ident.name == sym::count;
5252
if let ExprKind::MethodCall(filter, [filter_recv, filter_arg], _) = count_recv.kind;
5353
if filter.ident.name == sym!(filter);
54-
if let ExprKind::Closure(_, _, body_id, _, _) = filter_arg.kind;
55-
let body = cx.tcx.hir().body(body_id);
54+
if let ExprKind::Closure { body, .. } = filter_arg.kind;
55+
let body = cx.tcx.hir().body(body);
5656
if let [param] = body.params;
5757
if let PatKind::Binding(_, arg_id, _, _) = strip_pat_refs(param.pat).kind;
5858
if let ExprKind::Binary(ref op, l, r) = body.value.kind;

clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ fn is_linted_explicit_deref_position(parent: Option<Node<'_>>, child_id: HirId,
514514
| ExprKind::Loop(..)
515515
| ExprKind::Match(..)
516516
| ExprKind::Let(..)
517-
| ExprKind::Closure(..)
517+
| ExprKind::Closure{..}
518518
| ExprKind::Block(..)
519519
| ExprKind::Assign(..)
520520
| ExprKind::AssignOp(..)

clippy_lints/src/empty_structs_with_brackets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl EarlyLintPass for EmptyStructsWithBrackets {
4444
diagnostic.span_suggestion_hidden(
4545
span_after_ident,
4646
"remove the brackets",
47-
";".to_string(),
47+
";",
4848
Applicability::MachineApplicable);
4949
},
5050
);

clippy_lints/src/enum_clike.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ impl<'tcx> LateLintPass<'tcx> for UnportableVariant {
5050
.tcx
5151
.const_eval_poly(def_id.to_def_id())
5252
.ok()
53-
.map(|val| rustc_middle::ty::Const::from_value(cx.tcx, val, ty));
54-
if let Some(Constant::Int(val)) = constant.and_then(miri_to_const) {
53+
.map(|val| rustc_middle::mir::ConstantKind::from_value(val, ty));
54+
if let Some(Constant::Int(val)) = constant.and_then(|c| miri_to_const(cx.tcx, c)) {
5555
if let ty::Adt(adt, _) = ty.kind() {
5656
if adt.is_enum() {
5757
ty = adt.repr().discr_type().to_ty(cx.tcx);

clippy_lints/src/eta_reduction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
7878
return;
7979
}
8080
let body = match expr.kind {
81-
ExprKind::Closure(_, _, id, _, _) => cx.tcx.hir().body(id),
81+
ExprKind::Closure { body, .. } => cx.tcx.hir().body(body),
8282
_ => return,
8383
};
8484
if body.value.span.from_expansion() {

clippy_lints/src/infinite_iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ fn is_infinite(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness {
159159
}
160160
}
161161
if method.ident.name == sym!(flat_map) && args.len() == 2 {
162-
if let ExprKind::Closure(_, _, body_id, _, _) = args[1].kind {
163-
let body = cx.tcx.hir().body(body_id);
162+
if let ExprKind::Closure { body, .. } = args[1].kind {
163+
let body = cx.tcx.hir().body(body);
164164
return is_infinite(cx, &body.value);
165165
}
166166
}

0 commit comments

Comments
 (0)