Skip to content

Commit 57cbadd

Browse files
authored
Rustup (#14938)
r? @ghost changelog: none
2 parents 2948678 + cd71411 commit 57cbadd

39 files changed

+147
-156
lines changed

clippy_lints/src/arc_with_non_send_sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'tcx> LateLintPass<'tcx> for ArcWithNonSendSync {
5050
&& let arg_ty = cx.typeck_results().expr_ty(arg)
5151
// make sure that the type is not and does not contain any type parameters
5252
&& arg_ty.walk().all(|arg| {
53-
!matches!(arg.unpack(), GenericArgKind::Type(ty) if matches!(ty.kind(), ty::Param(_)))
53+
!matches!(arg.kind(), GenericArgKind::Type(ty) if matches!(ty.kind(), ty::Param(_)))
5454
})
5555
&& let Some(send) = cx.tcx.get_diagnostic_item(sym::Send)
5656
&& let Some(sync) = cx.tcx.lang_items().sync_trait()

clippy_lints/src/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ fn check_copy_clone<'tcx>(cx: &LateContext<'tcx>, item: &Item<'_>, trait_ref: &h
345345
if ty_adt.repr().packed()
346346
&& ty_subs
347347
.iter()
348-
.any(|arg| matches!(arg.unpack(), GenericArgKind::Type(_) | GenericArgKind::Const(_)))
348+
.any(|arg| matches!(arg.kind(), GenericArgKind::Type(_) | GenericArgKind::Const(_)))
349349
{
350350
return;
351351
}

clippy_lints/src/eta_reduction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ fn has_late_bound_to_non_late_bound_regions(from_sig: FnSig<'_>, to_sig: FnSig<'
306306
return true;
307307
}
308308
for (from_arg, to_arg) in to_subs.iter().zip(from_subs) {
309-
match (from_arg.unpack(), to_arg.unpack()) {
309+
match (from_arg.kind(), to_arg.kind()) {
310310
(GenericArgKind::Lifetime(from_region), GenericArgKind::Lifetime(to_region)) => {
311311
if check_region(from_region, to_region) {
312312
return true;
@@ -354,5 +354,5 @@ fn has_late_bound_to_non_late_bound_regions(from_sig: FnSig<'_>, to_sig: FnSig<'
354354

355355
fn ty_has_static(ty: Ty<'_>) -> bool {
356356
ty.walk()
357-
.any(|arg| matches!(arg.unpack(), GenericArgKind::Lifetime(re) if re.is_static()))
357+
.any(|arg| matches!(arg.kind(), GenericArgKind::Lifetime(re) if re.is_static()))
358358
}

clippy_lints/src/field_scoped_visibility_modifiers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ declare_lint_pass!(FieldScopedVisibilityModifiers => [FIELD_SCOPED_VISIBILITY_MO
5151

5252
impl EarlyLintPass for FieldScopedVisibilityModifiers {
5353
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
54-
let ItemKind::Struct(_, ref st, _) = item.kind else {
54+
let ItemKind::Struct(_, _, ref st) = item.kind else {
5555
return;
5656
};
5757
for field in st.fields() {

clippy_lints/src/functions/ref_option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn check_ty<'a>(cx: &LateContext<'a>, param: &rustc_hir::Ty<'a>, param_ty: Ty<'a
1717
&& is_type_diagnostic_item(cx, *opt_ty, sym::Option)
1818
&& let ty::Adt(_, opt_gen_args) = opt_ty.kind()
1919
&& let [gen_arg] = opt_gen_args.as_slice()
20-
&& let GenericArgKind::Type(gen_ty) = gen_arg.unpack()
20+
&& let GenericArgKind::Type(gen_ty) = gen_arg.kind()
2121
&& !gen_ty.is_ref()
2222
// Need to gen the original spans, so first parsing mid, and hir parsing afterward
2323
&& let hir::TyKind::Ref(lifetime, hir::MutTy { ty, .. }) = param.kind

clippy_lints/src/index_refutable_slice.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use rustc_hir::HirId;
1212
use rustc_hir::intravisit::{self, Visitor};
1313
use rustc_lint::{LateContext, LateLintPass};
1414
use rustc_middle::hir::nested_filter;
15-
use rustc_middle::ty;
1615
use rustc_session::impl_lint_pass;
1716
use rustc_span::Span;
1817
use rustc_span::symbol::Ident;
@@ -109,11 +108,11 @@ fn find_slice_values(cx: &LateContext<'_>, pat: &hir::Pat<'_>) -> FxIndexMap<Hir
109108
}
110109

111110
let bound_ty = cx.typeck_results().node_type(pat.hir_id);
112-
if let ty::Slice(inner_ty) | ty::Array(inner_ty, _) = bound_ty.peel_refs().kind() {
111+
if let Some(inner_ty) = bound_ty.peel_refs().builtin_index() {
113112
// The values need to use the `ref` keyword if they can't be copied.
114113
// This will need to be adjusted if the lint want to support mutable access in the future
115114
let src_is_ref = bound_ty.is_ref() && by_ref == hir::ByRef::No;
116-
let needs_ref = !(src_is_ref || is_copy(cx, *inner_ty));
115+
let needs_ref = !(src_is_ref || is_copy(cx, inner_ty));
117116

118117
let slice_info = slices
119118
.entry(value_hir_id)

clippy_lints/src/let_underscore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
137137
&& !local.span.in_external_macro(cx.tcx.sess.source_map())
138138
{
139139
let init_ty = cx.typeck_results().expr_ty(init);
140-
let contains_sync_guard = init_ty.walk().any(|inner| match inner.unpack() {
140+
let contains_sync_guard = init_ty.walk().any(|inner| match inner.kind() {
141141
GenericArgKind::Type(inner_ty) => inner_ty
142142
.ty_adt_def()
143143
.is_some_and(|adt| paths::PARKING_LOT_GUARDS.iter().any(|path| path.matches(cx, adt.did()))),

clippy_lints/src/manual_string_new.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_hir::{Expr, ExprKind, PathSegment, QPath, TyKind};
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_middle::ty;
77
use rustc_session::declare_lint_pass;
8-
use rustc_span::{Span, sym, symbol};
8+
use rustc_span::{Span, sym};
99

1010
declare_clippy_lint! {
1111
/// ### What it does
@@ -67,7 +67,7 @@ impl LateLintPass<'_> for ManualStringNew {
6767
fn is_expr_kind_empty_str(expr_kind: &ExprKind<'_>) -> bool {
6868
if let ExprKind::Lit(lit) = expr_kind
6969
&& let LitKind::Str(value, _) = lit.node
70-
&& value == symbol::kw::Empty
70+
&& value == sym::empty
7171
{
7272
return true;
7373
}

clippy_lints/src/matches/manual_unwrap_or.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn handle(
109109
&& implements_trait(cx, expr_type, default_trait_id, &[])
110110
// We check if the initial condition implements Default.
111111
&& let Some(condition_ty) = cx.typeck_results().expr_ty(condition).walk().nth(1)
112-
&& let GenericArgKind::Type(condition_ty) = condition_ty.unpack()
112+
&& let GenericArgKind::Type(condition_ty) = condition_ty.kind()
113113
&& implements_trait(cx, condition_ty, default_trait_id, &[])
114114
&& is_default_equivalent(cx, peel_blocks(body_none))
115115
{

clippy_lints/src/matches/redundant_pattern_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn find_match_true<'tcx>(
108108
fn try_get_generic_ty(ty: Ty<'_>, index: usize) -> Option<Ty<'_>> {
109109
if let ty::Adt(_, subs) = ty.kind()
110110
&& let Some(sub) = subs.get(index)
111-
&& let GenericArgKind::Type(sub_ty) = sub.unpack()
111+
&& let GenericArgKind::Type(sub_ty) = sub.kind()
112112
{
113113
Some(sub_ty)
114114
} else {

clippy_lints/src/matches/significant_drop_in_scrutinee.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,12 @@ impl<'a, 'tcx> SigDropChecker<'a, 'tcx> {
208208
// (to avoid false positive on `Ref<'a, MutexGuard<Foo>>`)
209209
|| (args
210210
.iter()
211-
.all(|arg| !matches!(arg.unpack(), GenericArgKind::Lifetime(_)))
211+
.all(|arg| !matches!(arg.kind(), GenericArgKind::Lifetime(_)))
212212
// some generic parameter has significant drop
213213
// (to avoid false negative on `Box<MutexGuard<Foo>>`)
214214
&& args
215215
.iter()
216-
.filter_map(|arg| match arg.unpack() {
216+
.filter_map(|arg| match arg.kind() {
217217
GenericArgKind::Type(ty) => Some(ty),
218218
_ => None,
219219
})

clippy_lints/src/methods/needless_collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ fn get_captured_ids(cx: &LateContext<'_>, ty: Ty<'_>) -> HirIdSet {
508508
match ty.kind() {
509509
ty::Adt(_, generics) => {
510510
for generic in *generics {
511-
if let GenericArgKind::Type(ty) = generic.unpack() {
511+
if let GenericArgKind::Type(ty) = generic.kind() {
512512
get_captured_ids_recursive(cx, ty, set);
513513
}
514514
}

clippy_lints/src/methods/or_fun_call.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ use clippy_utils::{
1111
use rustc_errors::Applicability;
1212
use rustc_lint::LateContext;
1313
use rustc_middle::ty;
14-
use rustc_span::Span;
15-
use rustc_span::symbol::{self, Symbol};
14+
use rustc_span::{Span, Symbol};
1615
use {rustc_ast as ast, rustc_hir as hir};
1716

1817
use super::{OR_FUN_CALL, UNWRAP_OR_DEFAULT};
@@ -265,7 +264,7 @@ fn closure_body_returns_empty_to_string(cx: &LateContext<'_>, e: &hir::Expr<'_>)
265264
&& ident.name == sym::to_string
266265
&& let hir::Expr { kind, .. } = self_arg
267266
&& let hir::ExprKind::Lit(lit) = kind
268-
&& let ast::LitKind::Str(symbol::kw::Empty, _) = lit.node
267+
&& let ast::LitKind::Str(rustc_span::sym::empty, _) = lit.node
269268
{
270269
return true;
271270
}

clippy_lints/src/methods/unnecessary_sort_by.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ fn detect_lint(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, arg: &Exp
189189

190190
fn expr_borrows(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
191191
let ty = cx.typeck_results().expr_ty(expr);
192-
matches!(ty.kind(), ty::Ref(..)) || ty.walk().any(|arg| matches!(arg.unpack(), GenericArgKind::Lifetime(_)))
192+
matches!(ty.kind(), ty::Ref(..)) || ty.walk().any(|arg| matches!(arg.kind(), GenericArgKind::Lifetime(_)))
193193
}
194194

195195
pub(super) fn check<'tcx>(

clippy_lints/src/methods/unnecessary_to_owned.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
608608
}
609609

610610
fn has_lifetime(ty: Ty<'_>) -> bool {
611-
ty.walk().any(|t| matches!(t.unpack(), GenericArgKind::Lifetime(_)))
611+
ty.walk().any(|t| matches!(t.kind(), GenericArgKind::Lifetime(_)))
612612
}
613613

614614
/// Returns true if the named method is `Iterator::cloned` or `Iterator::copied`.
@@ -643,7 +643,7 @@ fn is_to_string_on_string_like<'a>(
643643

644644
if let Some(args) = cx.typeck_results().node_args_opt(call_expr.hir_id)
645645
&& let [generic_arg] = args.as_slice()
646-
&& let GenericArgKind::Type(ty) = generic_arg.unpack()
646+
&& let GenericArgKind::Type(ty) = generic_arg.kind()
647647
&& let Some(deref_trait_id) = cx.tcx.get_diagnostic_item(sym::Deref)
648648
&& let Some(as_ref_trait_id) = cx.tcx.get_diagnostic_item(sym::AsRef)
649649
&& (cx.get_associated_type(ty, deref_trait_id, sym::Target) == Some(cx.tcx.types.str_)

clippy_lints/src/needless_borrows_for_generic_args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ fn needless_borrow_count<'tcx>(
269269
.tcx
270270
.is_diagnostic_item(sym::IntoIterator, trait_predicate.trait_ref.def_id)
271271
&& let ty::Param(param_ty) = trait_predicate.self_ty().kind()
272-
&& let GenericArgKind::Type(ty) = args_with_referent_ty[param_ty.index as usize].unpack()
272+
&& let GenericArgKind::Type(ty) = args_with_referent_ty[param_ty.index as usize].kind()
273273
&& ty.is_array()
274274
&& !msrv.meets(cx, msrvs::ARRAY_INTO_ITERATOR)
275275
{

clippy_lints/src/non_send_fields_in_send_ty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl NonSendField<'_> {
172172
/// Example: `MyStruct<P, Box<Q, R>>` => `vec![P, Q, R]`
173173
fn collect_generic_params(ty: Ty<'_>) -> Vec<Ty<'_>> {
174174
ty.walk()
175-
.filter_map(|inner| match inner.unpack() {
175+
.filter_map(|inner| match inner.kind() {
176176
GenericArgKind::Type(inner_ty) => Some(inner_ty),
177177
_ => None,
178178
})
@@ -208,7 +208,7 @@ fn ty_allowed_with_raw_pointer_heuristic<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'t
208208
ty::Adt(_, args) => {
209209
if contains_pointer_like(cx, ty) {
210210
// descends only if ADT contains any raw pointers
211-
args.iter().all(|generic_arg| match generic_arg.unpack() {
211+
args.iter().all(|generic_arg| match generic_arg.kind() {
212212
GenericArgKind::Type(ty) => ty_allowed_with_raw_pointer_heuristic(cx, ty, send_trait),
213213
// Lifetimes and const generics are not solid part of ADT and ignored
214214
GenericArgKind::Lifetime(_) | GenericArgKind::Const(_) => true,
@@ -226,7 +226,7 @@ fn ty_allowed_with_raw_pointer_heuristic<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'t
226226
/// Checks if the type contains any pointer-like types in args (including nested ones)
227227
fn contains_pointer_like<'tcx>(cx: &LateContext<'tcx>, target_ty: Ty<'tcx>) -> bool {
228228
for ty_node in target_ty.walk() {
229-
if let GenericArgKind::Type(inner_ty) = ty_node.unpack() {
229+
if let GenericArgKind::Type(inner_ty) = ty_node.kind() {
230230
match inner_ty.kind() {
231231
ty::RawPtr(_, _) => {
232232
return true;

clippy_lints/src/only_used_in_recursion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ impl<'tcx> LateLintPass<'tcx> for OnlyUsedInRecursion {
385385
fn has_matching_args(kind: FnKind, args: GenericArgsRef<'_>) -> bool {
386386
match kind {
387387
FnKind::Fn => true,
388-
FnKind::TraitFn => args.iter().enumerate().all(|(idx, subst)| match subst.unpack() {
388+
FnKind::TraitFn => args.iter().enumerate().all(|(idx, subst)| match subst.kind() {
389389
GenericArgKind::Lifetime(_) => true,
390390
GenericArgKind::Type(ty) => matches!(*ty.kind(), ty::Param(ty) if ty.index as usize == idx),
391391
GenericArgKind::Const(c) => matches!(c.kind(), ConstKind::Param(c) if c.index as usize == idx),

clippy_lints/src/partial_pub_fields.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ declare_lint_pass!(PartialPubFields => [PARTIAL_PUB_FIELDS]);
4141

4242
impl EarlyLintPass for PartialPubFields {
4343
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
44-
let ItemKind::Struct(_, ref st, _) = item.kind else {
44+
let ItemKind::Struct(_, _, ref st) = item.kind else {
4545
return;
4646
};
4747

clippy_lints/src/returns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ fn last_statement_borrows<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>)
489489
.skip_binder()
490490
.output()
491491
.walk()
492-
.any(|arg| matches!(arg.unpack(), GenericArgKind::Lifetime(re) if !re.is_static()))
492+
.any(|arg| matches!(arg.kind(), GenericArgKind::Lifetime(re) if !re.is_static()))
493493
{
494494
ControlFlow::Break(())
495495
} else {

clippy_lints/src/significant_drop_tightening.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl<'cx, 'others, 'tcx> AttrChecker<'cx, 'others, 'tcx> {
184184
}
185185
}
186186
for generic_arg in *b {
187-
if let GenericArgKind::Type(ty) = generic_arg.unpack()
187+
if let GenericArgKind::Type(ty) = generic_arg.kind()
188188
&& self.has_sig_drop_attr(ty, depth)
189189
{
190190
return true;

clippy_lints/src/tuple_array_conversions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl LateLintPass<'_> for TupleArrayConversions {
6666
}
6767

6868
fn check_array<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, elements: &'tcx [Expr<'tcx>]) {
69-
let (ty::Array(ty, _) | ty::Slice(ty)) = cx.typeck_results().expr_ty(expr).kind() else {
69+
let Some(ty) = cx.typeck_results().expr_ty(expr).builtin_index() else {
7070
unreachable!("`expr` must be an array or slice due to `ExprKind::Array`");
7171
};
7272

@@ -85,7 +85,7 @@ fn check_array<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, elements: &
8585
ExprKind::Path(_) => Some(elements.iter().collect()),
8686
_ => None,
8787
})
88-
&& all_bindings_are_for_conv(cx, &[*ty], expr, elements, &locals, ToType::Array)
88+
&& all_bindings_are_for_conv(cx, &[ty], expr, elements, &locals, ToType::Array)
8989
&& !is_from_proc_macro(cx, expr)
9090
{
9191
span_lint_and_help(

clippy_lints/src/use_self.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ fn same_lifetimes<'tcx>(a: MiddleTy<'tcx>, b: MiddleTy<'tcx>) -> bool {
319319
args_a
320320
.iter()
321321
.zip(args_b.iter())
322-
.all(|(arg_a, arg_b)| match (arg_a.unpack(), arg_b.unpack()) {
322+
.all(|(arg_a, arg_b)| match (arg_a.kind(), arg_b.kind()) {
323323
// TODO: Handle inferred lifetimes
324324
(GenericArgKind::Lifetime(inner_a), GenericArgKind::Lifetime(inner_b)) => inner_a == inner_b,
325325
(GenericArgKind::Type(type_a), GenericArgKind::Type(type_b)) => same_lifetimes(type_a, type_b),
@@ -337,7 +337,7 @@ fn has_no_lifetime(ty: MiddleTy<'_>) -> bool {
337337
&Adt(_, args) => !args
338338
.iter()
339339
// TODO: Handle inferred lifetimes
340-
.any(|arg| matches!(arg.unpack(), GenericArgKind::Lifetime(..))),
340+
.any(|arg| matches!(arg.kind(), GenericArgKind::Lifetime(..))),
341341
_ => true,
342342
}
343343
}

clippy_lints_internal/src/msrv_attr_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl LateLintPass<'_> for MsrvAttrImpl {
3737
.type_of(f.did)
3838
.instantiate_identity()
3939
.walk()
40-
.filter(|t| matches!(t.unpack(), GenericArgKind::Type(_)))
40+
.filter(|t| matches!(t.kind(), GenericArgKind::Type(_)))
4141
.any(|t| internal_paths::MSRV_STACK.matches_ty(cx, t.expect_ty()))
4242
})
4343
&& !items.iter().any(|item| item.ident.name.as_str() == "check_attributes")

clippy_utils/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This crate is only guaranteed to build with this `nightly` toolchain:
88

99
<!-- begin autogenerated nightly -->
1010
```
11-
nightly-2025-05-21
11+
nightly-2025-05-31
1212
```
1313
<!-- end autogenerated nightly -->
1414

clippy_utils/src/ast_utils/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,11 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
436436
&& over(lb, rb, eq_generic_bound)
437437
&& both(lt.as_ref(), rt.as_ref(), |l, r| eq_ty(l, r))
438438
},
439-
(Enum(li, le, lg), Enum(ri, re, rg)) => {
440-
eq_id(*li, *ri) && over(&le.variants, &re.variants, eq_variant) && eq_generics(lg, rg)
439+
(Enum(li, lg, le), Enum(ri, rg, re)) => {
440+
eq_id(*li, *ri) && eq_generics(lg, rg) && over(&le.variants, &re.variants, eq_variant)
441441
},
442-
(Struct(li, lv, lg), Struct(ri, rv, rg)) | (Union(li, lv, lg), Union(ri, rv, rg)) => {
443-
eq_id(*li, *ri) && eq_variant_data(lv, rv) && eq_generics(lg, rg)
442+
(Struct(li, lg, lv), Struct(ri, rg, rv)) | (Union(li, lg, lv), Union(ri, rg, rv)) => {
443+
eq_id(*li, *ri) && eq_generics(lg, rg) && eq_variant_data(lv, rv)
444444
},
445445
(
446446
Trait(box ast::Trait {

clippy_utils/src/consts.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,7 @@ impl Constant<'_> {
235235
_ => None,
236236
},
237237
(Self::Vec(l), Self::Vec(r)) => {
238-
let (ty::Array(cmp_type, _) | ty::Slice(cmp_type)) = *cmp_type.kind() else {
239-
return None;
240-
};
238+
let cmp_type = cmp_type.builtin_index()?;
241239
iter::zip(l, r)
242240
.map(|(li, ri)| Self::partial_cmp(tcx, cmp_type, li, ri))
243241
.find(|r| r.is_none_or(|o| o != Ordering::Equal))

clippy_utils/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3318,7 +3318,7 @@ pub fn leaks_droppable_temporary_with_limited_lifetime<'tcx>(cx: &LateContext<'t
33183318
if temporary_ty.has_significant_drop(cx.tcx, cx.typing_env())
33193319
&& temporary_ty
33203320
.walk()
3321-
.any(|arg| matches!(arg.unpack(), GenericArgKind::Lifetime(re) if !re.is_static()))
3321+
.any(|arg| matches!(arg.kind(), GenericArgKind::Lifetime(re) if !re.is_static()))
33223322
{
33233323
ControlFlow::Break(())
33243324
} else {

clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn is_min_const_fn<'tcx>(cx: &LateContext<'tcx>, body: &Body<'tcx>, msrv: Ms
5555

5656
fn check_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, span: Span, msrv: Msrv) -> McfResult {
5757
for arg in ty.walk() {
58-
let ty = match arg.unpack() {
58+
let ty = match arg.kind() {
5959
GenericArgKind::Type(ty) => ty,
6060

6161
// No constraints on lifetimes or constants, except potentially

clippy_utils/src/sugg.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,9 @@ impl<'tcx> Delegate<'tcx> for DerefDelegate<'_, 'tcx> {
940940
// note: unable to trigger `Subslice` kind in tests
941941
ProjectionKind::Subslice |
942942
// Doesn't have surface syntax. Only occurs in patterns.
943-
ProjectionKind::OpaqueCast => (),
943+
ProjectionKind::OpaqueCast |
944+
// Only occurs in closure captures.
945+
ProjectionKind::UnwrapUnsafeBinder => (),
944946
ProjectionKind::Deref => {
945947
// Explicit derefs are typically handled later on, but
946948
// some items do not need explicit deref, such as array accesses,

0 commit comments

Comments
 (0)