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 {

0 commit comments

Comments
 (0)