Skip to content

Commit 327967c

Browse files
Rename unpack to kind
1 parent ce0adf0 commit 327967c

22 files changed

+32
-32
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/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/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/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/unnecessary_sort_by.rs

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

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

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

0 commit comments

Comments
 (0)