Skip to content

Commit dc5423a

Browse files
committed
Auto merge of rust-lang#8534 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents e2e492c + 2ebd0b2 commit dc5423a

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

+194
-186
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ rustc-workspace-hack = "1.0"
4343
clippy_utils = { path = "clippy_utils" }
4444
derive-new = "0.5"
4545
if_chain = "1.0"
46-
itertools = "0.10"
46+
itertools = "0.10.1"
4747
quote = "1.0"
4848
serde = { version = "1.0", features = ["derive"] }
4949
syn = { version = "1.0", features = ["full"] }

clippy_dev/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77
bytecount = "0.6"
88
clap = "2.33"
99
indoc = "1.0"
10-
itertools = "0.10"
10+
itertools = "0.10.1"
1111
opener = "0.5"
1212
regex = "1.5"
1313
shell-escape = "0.1"

clippy_lints/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ edition = "2021"
1212
cargo_metadata = "0.14"
1313
clippy_utils = { path = "../clippy_utils" }
1414
if_chain = "1.0"
15-
itertools = "0.10"
15+
itertools = "0.10.1"
1616
pulldown-cmark = { version = "0.9", default-features = false }
1717
quine-mc_cluskey = "0.2"
1818
regex-syntax = "0.6"

clippy_lints/src/await_holding_invalid.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl LateLintPass<'_> for AwaitHolding {
149149
fn check_interior_types(cx: &LateContext<'_>, ty_causes: &[GeneratorInteriorTypeCause<'_>], span: Span) {
150150
for ty_cause in ty_causes {
151151
if let rustc_middle::ty::Adt(adt, _) = ty_cause.ty.kind() {
152-
if is_mutex_guard(cx, adt.did) {
152+
if is_mutex_guard(cx, adt.did()) {
153153
span_lint_and_then(
154154
cx,
155155
AWAIT_HOLDING_LOCK,
@@ -167,7 +167,7 @@ fn check_interior_types(cx: &LateContext<'_>, ty_causes: &[GeneratorInteriorType
167167
},
168168
);
169169
}
170-
if is_refcell_ref(cx, adt.did) {
170+
if is_refcell_ref(cx, adt.did()) {
171171
span_lint_and_then(
172172
cx,
173173
AWAIT_HOLDING_REFCELL_REF,

clippy_lints/src/case_sensitive_file_extension_comparisons.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_help;
22
use if_chain::if_chain;
33
use rustc_ast::ast::LitKind;
4+
use rustc_data_structures::intern::Interned;
45
use rustc_hir::{Expr, ExprKind, PathSegment};
56
use rustc_lint::{LateContext, LateLintPass};
67
use rustc_middle::ty;
@@ -55,7 +56,7 @@ fn check_case_sensitive_file_extension_comparison(ctx: &LateContext<'_>, expr: &
5556
ty::Str => {
5657
return Some(span);
5758
},
58-
ty::Adt(&ty::AdtDef { did, .. }, _) => {
59+
ty::Adt(ty::AdtDef(Interned(&ty::AdtDefData { did, .. }, _)), _) => {
5960
if ctx.tcx.is_diagnostic_item(sym::String, did) {
6061
return Some(span);
6162
}

clippy_lints/src/casts/cast_possible_truncation.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
116116
&& let Res::Def(DefKind::Ctor(..), id) = cx.qpath_res(p, cast_expr.hir_id)
117117
{
118118
let i = def.variant_index_with_ctor_id(id);
119-
let variant = &def.variants[i];
120-
let nbits = utils::enum_value_nbits(get_discriminant_value(cx.tcx, def, i));
119+
let variant = def.variant(i);
120+
let nbits = utils::enum_value_nbits(get_discriminant_value(cx.tcx, *def, i));
121121
(nbits, Some(variant))
122122
} else {
123-
(utils::enum_ty_to_nbits(def, cx.tcx), None)
123+
(utils::enum_ty_to_nbits(*def, cx.tcx), None)
124124
};
125125
let to_nbits = utils::int_ty_to_nbits(cast_to, cx.tcx);
126126

127-
let cast_from_ptr_size = def.repr.int.map_or(true, |ty| {
127+
let cast_from_ptr_size = def.repr().int.map_or(true, |ty| {
128128
matches!(
129129
ty,
130130
IntType::SignedInt(ast::IntTy::Isize) | IntType::UnsignedInt(ast::UintTy::Usize)

clippy_lints/src/casts/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ pub(super) fn enum_value_nbits(value: EnumValue) -> u64 {
3434
.into()
3535
}
3636

37-
pub(super) fn enum_ty_to_nbits(adt: &AdtDef, tcx: TyCtxt<'_>) -> u64 {
37+
pub(super) fn enum_ty_to_nbits(adt: AdtDef<'_>, tcx: TyCtxt<'_>) -> u64 {
3838
let mut explicit = 0i128;
3939
let (start, end) = adt
40-
.variants
40+
.variants()
4141
.iter()
4242
.fold((0, i128::MIN), |(start, end), variant| match variant.discr {
4343
VariantDiscr::Relative(x) => match explicit.checked_add(i128::from(x)) {

clippy_lints/src/copies.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clippy_utils::{
66
};
77
use if_chain::if_chain;
88
use rustc_data_structures::fx::FxHashSet;
9-
use rustc_errors::{Applicability, DiagnosticBuilder};
9+
use rustc_errors::{Applicability, Diagnostic};
1010
use rustc_hir::intravisit::{self, Visitor};
1111
use rustc_hir::{Block, Expr, ExprKind, HirId};
1212
use rustc_lint::{LateContext, LateLintPass, LintContext};
@@ -489,7 +489,7 @@ fn emit_branches_sharing_code_lint(
489489
add_expr_note = !cx.typeck_results().expr_ty(if_expr).is_unit();
490490
}
491491

492-
let add_optional_msgs = |diag: &mut DiagnosticBuilder<'_>| {
492+
let add_optional_msgs = |diag: &mut Diagnostic| {
493493
if add_expr_note {
494494
diag.note("The end suggestion probably needs some adjustments to use the expression result correctly");
495495
}

clippy_lints/src/default.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
9696
then {
9797
// TODO: Work out a way to put "whatever the imported way of referencing
9898
// this type in this file" rather than a fully-qualified type.
99-
let replacement = format!("{}::default()", cx.tcx.def_path_str(def.did));
99+
let replacement = format!("{}::default()", cx.tcx.def_path_str(def.did()));
100100
span_lint_and_sugg(
101101
cx,
102102
DEFAULT_TRAIT_ACCESS,
@@ -137,7 +137,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
137137
if let Some(adt) = binding_type.ty_adt_def();
138138
if adt.is_struct();
139139
let variant = adt.non_enum_variant();
140-
if adt.did.is_local() || !variant.is_field_list_non_exhaustive();
140+
if adt.did().is_local() || !variant.is_field_list_non_exhaustive();
141141
let module_did = cx.tcx.parent_module(stmt.hir_id).to_def_id();
142142
if variant
143143
.fields
@@ -216,7 +216,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
216216
if let ty::Adt(adt_def, substs) = binding_type.kind();
217217
if !substs.is_empty();
218218
then {
219-
let adt_def_ty_name = cx.tcx.item_name(adt_def.did);
219+
let adt_def_ty_name = cx.tcx.item_name(adt_def.did());
220220
let generic_args = substs.iter().collect::<Vec<_>>();
221221
let tys_str = generic_args
222222
.iter()

clippy_lints/src/default_numeric_fallback.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NumericFallbackVisitor<'a, 'tcx> {
148148
if_chain! {
149149
if let Some(adt_def) = ty.ty_adt_def();
150150
if adt_def.is_struct();
151-
if let Some(variant) = adt_def.variants.iter().next();
151+
if let Some(variant) = adt_def.variants().iter().next();
152152
then {
153153
let fields_def = &variant.fields;
154154

clippy_lints/src/derivable_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
103103
_ => false,
104104
};
105105
if should_emit {
106-
let path_string = cx.tcx.def_path_str(adt_def.did);
106+
let path_string = cx.tcx.def_path_str(adt_def.did());
107107
span_lint_and_help(
108108
cx,
109109
DERIVABLE_IMPLS,

clippy_lints/src/derive.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ fn check_copy_clone<'tcx>(cx: &LateContext<'tcx>, item: &Item<'_>, trait_ref: &T
315315
let has_copy_impl = cx.tcx.all_local_trait_impls(()).get(&copy_id).map_or(false, |impls| {
316316
impls
317317
.iter()
318-
.any(|&id| matches!(cx.tcx.type_of(id).kind(), ty::Adt(adt, _) if ty_adt.did == adt.did))
318+
.any(|&id| matches!(cx.tcx.type_of(id).kind(), ty::Adt(adt, _) if ty_adt.did() == adt.did()))
319319
});
320320
if !has_copy_impl {
321321
return;
@@ -357,10 +357,10 @@ fn check_unsafe_derive_deserialize<'tcx>(
357357
if let Some(trait_def_id) = trait_ref.trait_def_id();
358358
if match_def_path(cx, trait_def_id, &paths::SERDE_DESERIALIZE);
359359
if let ty::Adt(def, _) = ty.kind();
360-
if let Some(local_def_id) = def.did.as_local();
360+
if let Some(local_def_id) = def.did().as_local();
361361
let adt_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
362362
if !is_lint_allowed(cx, UNSAFE_DERIVE_DESERIALIZE, adt_hir_id);
363-
if cx.tcx.inherent_impls(def.did)
363+
if cx.tcx.inherent_impls(def.did())
364364
.iter()
365365
.map(|imp_did| cx.tcx.hir().expect_item(imp_did.expect_local()))
366366
.any(|imp| has_unsafe(cx, imp));

clippy_lints/src/doc.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,7 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
628628
let mut parser = match maybe_new_parser_from_source_str(&sess, filename, code) {
629629
Ok(p) => p,
630630
Err(errs) => {
631-
for mut err in errs {
632-
err.cancel();
633-
}
631+
drop(errs);
634632
return false;
635633
},
636634
};
@@ -668,7 +666,7 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
668666
_ => {},
669667
},
670668
Ok(None) => break,
671-
Err(mut e) => {
669+
Err(e) => {
672670
e.cancel();
673671
return false;
674672
},

clippy_lints/src/empty_enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<'tcx> LateLintPass<'tcx> for EmptyEnum {
5252
if let ItemKind::Enum(..) = item.kind {
5353
let ty = cx.tcx.type_of(item.def_id);
5454
let adt = ty.ty_adt_def().expect("already checked whether this is an enum");
55-
if adt.variants.is_empty() {
55+
if adt.variants().is_empty() {
5656
span_lint_and_help(
5757
cx,
5858
EMPTY_ENUM,

clippy_lints/src/enum_clike.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'tcx> LateLintPass<'tcx> for UnportableVariant {
5555
if let Some(Constant::Int(val)) = constant.and_then(miri_to_const) {
5656
if let ty::Adt(adt, _) = ty.kind() {
5757
if adt.is_enum() {
58-
ty = adt.repr.discr_type().to_ty(cx.tcx);
58+
ty = adt.repr().discr_type().to_ty(cx.tcx);
5959
}
6060
}
6161
match ty.kind() {

clippy_lints/src/eq_op.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ fn in_impl<'tcx>(
306306
fn are_equal<'tcx>(cx: &LateContext<'tcx>, middle_ty: Ty<'_>, hir_ty: &rustc_hir::Ty<'_>) -> bool {
307307
if_chain! {
308308
if let ty::Adt(adt_def, _) = middle_ty.kind();
309-
if let Some(local_did) = adt_def.did.as_local();
309+
if let Some(local_did) = adt_def.did().as_local();
310310
let item = cx.tcx.hir().expect_item(local_did);
311311
let middle_ty_id = item.def_id.to_def_id();
312312
if let TyKind::Path(QPath::Resolved(_, path)) = hir_ty.kind;

clippy_lints/src/eta_reduction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ fn get_ufcs_type_name(cx: &LateContext<'_>, method_def_id: DefId) -> String {
224224
ty::ImplContainer(def_id) => {
225225
let ty = cx.tcx.type_of(def_id);
226226
match ty.kind() {
227-
ty::Adt(adt, _) => cx.tcx.def_path_str(adt.did),
227+
ty::Adt(adt, _) => cx.tcx.def_path_str(adt.did()),
228228
_ => ty.to_string(),
229229
}
230230
},

clippy_lints/src/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'tcx> LateLintPass<'tcx> for UselessFormat {
7272
if_chain! {
7373
if format_args.format_string_parts == [kw::Empty];
7474
if match cx.typeck_results().expr_ty(value).peel_refs().kind() {
75-
ty::Adt(adt, _) => cx.tcx.is_diagnostic_item(sym::String, adt.did),
75+
ty::Adt(adt, _) => cx.tcx.is_diagnostic_item(sym::String, adt.did()),
7676
ty::Str => true,
7777
_ => false,
7878
};

clippy_lints/src/functions/must_use.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ fn is_mutable_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, span: Span, tys: &m
189189
// primitive types are never mutable
190190
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Str => false,
191191
ty::Adt(adt, substs) => {
192-
tys.insert(adt.did) && !ty.is_freeze(cx.tcx.at(span), cx.param_env)
193-
|| KNOWN_WRAPPER_TYS.iter().any(|path| match_def_path(cx, adt.did, path))
192+
tys.insert(adt.did()) && !ty.is_freeze(cx.tcx.at(span), cx.param_env)
193+
|| KNOWN_WRAPPER_TYS.iter().any(|path| match_def_path(cx, adt.did(), path))
194194
&& substs.types().any(|ty| is_mutable_ty(cx, ty, span, tys))
195195
},
196196
ty::Tuple(substs) => substs.iter().any(|ty| is_mutable_ty(cx, ty, span, tys)),

clippy_lints/src/implicit_hasher.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::borrow::Cow;
22
use std::collections::BTreeMap;
33

4-
use rustc_errors::DiagnosticBuilder;
4+
use rustc_errors::Diagnostic;
55
use rustc_hir as hir;
66
use rustc_hir::intravisit::{walk_body, walk_expr, walk_inf, walk_ty, Visitor};
77
use rustc_hir::{Body, Expr, ExprKind, GenericArg, Item, ItemKind, QPath, TyKind};
@@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitHasher {
6868

6969
fn suggestion<'tcx>(
7070
cx: &LateContext<'tcx>,
71-
diag: &mut DiagnosticBuilder<'_>,
71+
diag: &mut Diagnostic,
7272
generics_span: Span,
7373
generics_suggestion_span: Span,
7474
target: &ImplicitHasherType<'_>,

clippy_lints/src/inconsistent_struct_constructor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'tcx> LateLintPass<'tcx> for InconsistentStructConstructor {
7171
let ty = cx.typeck_results().expr_ty(expr);
7272
if let Some(adt_def) = ty.ty_adt_def();
7373
if adt_def.is_struct();
74-
if let Some(variant) = adt_def.variants.iter().next();
74+
if let Some(variant) = adt_def.variants().iter().next();
7575
if fields.iter().all(|f| f.is_shorthand);
7676
then {
7777
let mut def_order_map = FxHashMap::default();

clippy_lints/src/inline_fn_without_body.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! checks for `#[inline]` on trait methods without bodies
22
33
use clippy_utils::diagnostics::span_lint_and_then;
4-
use clippy_utils::sugg::DiagnosticBuilderExt;
4+
use clippy_utils::sugg::DiagnosticExt;
55
use rustc_ast::ast::Attribute;
66
use rustc_errors::Applicability;
77
use rustc_hir::{TraitFn, TraitItem, TraitItemKind};

clippy_lints/src/large_enum_variant.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ impl<'tcx> LateLintPass<'tcx> for LargeEnumVariant {
8181
if let ItemKind::Enum(ref def, _) = item.kind {
8282
let ty = cx.tcx.type_of(item.def_id);
8383
let adt = ty.ty_adt_def().expect("already checked whether this is an enum");
84-
if adt.variants.len() <= 1 {
84+
if adt.variants().len() <= 1 {
8585
return;
8686
}
8787
let mut variants_size: Vec<VariantInfo> = Vec::new();
88-
for (i, variant) in adt.variants.iter().enumerate() {
88+
for (i, variant) in adt.variants().iter().enumerate() {
8989
let mut fields_size = Vec::new();
9090
for (i, f) in variant.fields.iter().enumerate() {
9191
let ty = cx.tcx.type_of(f.did);

clippy_lints/src/len_zero.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,13 @@ enum LenOutput<'tcx> {
248248
fn parse_len_output<'tcx>(cx: &LateContext<'_>, sig: FnSig<'tcx>) -> Option<LenOutput<'tcx>> {
249249
match *sig.output().kind() {
250250
ty::Int(_) | ty::Uint(_) => Some(LenOutput::Integral),
251-
ty::Adt(adt, subs) if cx.tcx.is_diagnostic_item(sym::Option, adt.did) => {
252-
subs.type_at(0).is_integral().then(|| LenOutput::Option(adt.did))
251+
ty::Adt(adt, subs) if cx.tcx.is_diagnostic_item(sym::Option, adt.did()) => {
252+
subs.type_at(0).is_integral().then(|| LenOutput::Option(adt.did()))
253253
},
254-
ty::Adt(adt, subs) if cx.tcx.is_diagnostic_item(sym::Result, adt.did) => subs
254+
ty::Adt(adt, subs) if cx.tcx.is_diagnostic_item(sym::Result, adt.did()) => subs
255255
.type_at(0)
256256
.is_integral()
257-
.then(|| LenOutput::Result(adt.did, subs.type_at(1))),
257+
.then(|| LenOutput::Result(adt.did(), subs.type_at(1))),
258258
_ => None,
259259
}
260260
}
@@ -263,8 +263,8 @@ impl LenOutput<'_> {
263263
fn matches_is_empty_output(self, ty: Ty<'_>) -> bool {
264264
match (self, ty.kind()) {
265265
(_, &ty::Bool) => true,
266-
(Self::Option(id), &ty::Adt(adt, subs)) if id == adt.did => subs.type_at(0).is_bool(),
267-
(Self::Result(id, err_ty), &ty::Adt(adt, subs)) if id == adt.did => {
266+
(Self::Option(id), &ty::Adt(adt, subs)) if id == adt.did() => subs.type_at(0).is_bool(),
267+
(Self::Result(id, err_ty), &ty::Adt(adt, subs)) if id == adt.did() => {
268268
subs.type_at(0).is_bool() && subs.type_at(1) == err_ty
269269
},
270270
_ => false,
@@ -488,7 +488,7 @@ fn has_is_empty(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
488488
.any(|item| is_is_empty(cx, item))
489489
}),
490490
ty::Projection(ref proj) => has_is_empty_impl(cx, proj.item_def_id),
491-
ty::Adt(id, _) => has_is_empty_impl(cx, id.did),
491+
ty::Adt(id, _) => has_is_empty_impl(cx, id.did()),
492492
ty::Array(..) | ty::Slice(..) | ty::Str => true,
493493
_ => false,
494494
}

clippy_lints/src/loops/manual_memcpy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ struct Start<'hir> {
334334

335335
fn get_slice_like_element_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'tcx>> {
336336
match ty.kind() {
337-
ty::Adt(adt, subs) if cx.tcx.is_diagnostic_item(sym::Vec, adt.did) => Some(subs.type_at(0)),
337+
ty::Adt(adt, subs) if cx.tcx.is_diagnostic_item(sym::Vec, adt.did()) => Some(subs.type_at(0)),
338338
ty::Ref(_, subty, _) => get_slice_like_element_ty(cx, *subty),
339339
ty::Slice(ty) | ty::Array(ty, _) => Some(*ty),
340340
_ => None,

clippy_lints/src/loops/missing_spin_loop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, cond: &'tcx Expr<'_>, body: &'
3636
if let ExprKind::MethodCall(method, [callee, ..], _) = unpack_cond(cond).kind;
3737
if [sym::load, sym::compare_exchange, sym::compare_exchange_weak].contains(&method.ident.name);
3838
if let ty::Adt(def, _substs) = cx.typeck_results().expr_ty(callee).kind();
39-
if cx.tcx.is_diagnostic_item(sym::AtomicBool, def.did);
39+
if cx.tcx.is_diagnostic_item(sym::AtomicBool, def.did());
4040
then {
4141
span_lint_and_sugg(
4242
cx,

clippy_lints/src/matches/match_wild_enum.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ pub(crate) fn check(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>]) {
4545

4646
// Accumulate the variants which should be put in place of the wildcard because they're not
4747
// already covered.
48-
let has_hidden = adt_def.variants.iter().any(|x| is_hidden(cx, x));
49-
let mut missing_variants: Vec<_> = adt_def.variants.iter().filter(|x| !is_hidden(cx, x)).collect();
48+
let has_hidden = adt_def.variants().iter().any(|x| is_hidden(cx, x));
49+
let mut missing_variants: Vec<_> = adt_def.variants().iter().filter(|x| !is_hidden(cx, x)).collect();
5050

5151
let mut path_prefix = CommonPrefixSearcher::None;
5252
for arm in arms {
@@ -118,7 +118,7 @@ pub(crate) fn check(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>]) {
118118
}
119119
s
120120
} else {
121-
let mut s = cx.tcx.def_path_str(adt_def.did);
121+
let mut s = cx.tcx.def_path_str(adt_def.did());
122122
s.push_str("::");
123123
s
124124
},

clippy_lints/src/methods/bind_instead_of_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ pub(crate) trait BindInsteadOfMap {
145145
if_chain! {
146146
if let Some(adt) = cx.typeck_results().expr_ty(recv).ty_adt_def();
147147
if let Ok(vid) = cx.tcx.lang_items().require(Self::VARIANT_LANG_ITEM);
148-
if Some(adt.did) == cx.tcx.parent(vid);
148+
if Some(adt.did()) == cx.tcx.parent(vid);
149149
then {} else { return false; }
150150
}
151151

clippy_lints/src/methods/cloned_instead_of_copied.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, span: Span,
1515
let inner_ty = match recv_ty.kind() {
1616
// `Option<T>` -> `T`
1717
ty::Adt(adt, subst)
18-
if cx.tcx.is_diagnostic_item(sym::Option, adt.did) && meets_msrv(msrv, &msrvs::OPTION_COPIED) =>
18+
if cx.tcx.is_diagnostic_item(sym::Option, adt.did()) && meets_msrv(msrv, &msrvs::OPTION_COPIED) =>
1919
{
2020
subst.type_at(0)
2121
},

0 commit comments

Comments
 (0)