Skip to content

Commit 09382ed

Browse files
authored
Rustup (#17389)
r? @ghost changelog: none
2 parents b7ea12b + 1a03a2d commit 09382ed

37 files changed

Lines changed: 213 additions & 163 deletions

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.98"
3+
version = "0.1.99"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_config"
3-
version = "0.1.98"
3+
version = "0.1.99"
44
edition = "2024"
55
publish = false
66

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.98"
3+
version = "0.1.99"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/src/bool_assert_comparison.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn is_impl_not_trait_with_bool_out<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -
6363
)
6464
})
6565
.is_some_and(|assoc_item| {
66-
let proj = Ty::new_projection(cx.tcx, assoc_item.def_id, cx.tcx.mk_args_trait(ty, []));
66+
let proj = Ty::new_projection(cx.tcx, ty::IsRigid::No, assoc_item.def_id, cx.tcx.mk_args_trait(ty, []));
6767
let nty = cx
6868
.tcx
6969
.normalize_erasing_regions(cx.typing_env(), Unnormalized::new_wip(proj));

clippy_lints/src/combined_early_pass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! inlined calls. No vtable, no per-node dynamic dispatch.
1212
//!
1313
//! Unlike the late combine there is no `active` gate. rustc drops fully-disabled
14-
//! late passes via `lints_that_dont_need_to_run`, but the early pass runner has
14+
//! late passes via `skippable_lints`, but the early pass runner has
1515
//! no such filtering, so a plain forward is equivalent and loses nothing.
1616
//!
1717
//! [`combined_late_pass`]: crate::combined_late_pass

clippy_lints/src/dereference.rs

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -925,21 +925,30 @@ impl TyCoercionStability {
925925
continue;
926926
},
927927
ty::Param(_) if for_return => Self::Deref,
928-
ty::Alias(ty::AliasTy {
929-
kind: ty::Free { .. } | ty::Inherent { .. },
930-
..
931-
}) => unreachable!("should have been normalized away above"),
932-
ty::Alias(ty::AliasTy {
933-
kind: ty::Projection { .. },
934-
..
935-
}) if !for_return && ty.has_non_region_param() => Self::Reborrow,
928+
ty::Alias(
929+
_,
930+
ty::AliasTy {
931+
kind: ty::Free { .. } | ty::Inherent { .. },
932+
..
933+
},
934+
) => unreachable!("should have been normalized away above"),
935+
ty::Alias(
936+
_,
937+
ty::AliasTy {
938+
kind: ty::Projection { .. },
939+
..
940+
},
941+
) if !for_return && ty.has_non_region_param() => Self::Reborrow,
936942
ty::Infer(_)
937943
| ty::Error(_)
938944
| ty::Bound(..)
939-
| ty::Alias(ty::AliasTy {
940-
kind: ty::Opaque { .. },
941-
..
942-
})
945+
| ty::Alias(
946+
_,
947+
ty::AliasTy {
948+
kind: ty::Opaque { .. },
949+
..
950+
},
951+
)
943952
| ty::Placeholder(_)
944953
| ty::Dynamic(..)
945954
| ty::Param(_) => Self::Reborrow,
@@ -970,10 +979,13 @@ impl TyCoercionStability {
970979
| ty::CoroutineClosure(..)
971980
| ty::Never
972981
| ty::Tuple(_)
973-
| ty::Alias(ty::AliasTy {
974-
kind: ty::Projection { .. },
975-
..
976-
})
982+
| ty::Alias(
983+
_,
984+
ty::AliasTy {
985+
kind: ty::Projection { .. },
986+
..
987+
},
988+
)
977989
| ty::UnsafeBinder(_) => Self::Deref,
978990
};
979991
}

clippy_lints/src/from_over_into.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ impl<'tcx> LateLintPass<'tcx> for FromOverInto {
7878
&& span_is_local(item.span)
7979
&& let middle_trait_ref = cx.tcx.impl_trait_ref(item.owner_id).instantiate_identity().skip_norm_wip()
8080
&& cx.tcx.is_diagnostic_item(sym::Into, middle_trait_ref.def_id)
81-
&& !matches!(middle_trait_ref.args.type_at(1).kind(), ty::Alias(ty::AliasTy { kind: ty::Opaque{..} , .. }))
81+
&& !matches!(
82+
middle_trait_ref.args.type_at(1).kind(),
83+
ty::Alias(_, ty::AliasTy { kind: ty::Opaque{..} , .. })
84+
)
8285
&& self.msrv.meets(cx, msrvs::RE_REBALANCING_COHERENCE)
8386
// skip if there's a blanket From impl, the suggested impl would conflict
8487
&& !has_blanket_from_impl(cx, middle_trait_ref.self_ty())

clippy_lints/src/future_not_send.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
7676
return;
7777
}
7878
let ret_ty = return_ty(cx, cx.tcx.local_def_id_to_hir_id(fn_def_id).expect_owner());
79-
if let ty::Alias(AliasTy { kind: ty::Opaque{def_id}, args, .. }) = *ret_ty.kind()
79+
if let ty::Alias(_, AliasTy { kind: ty::Opaque{def_id}, args, .. }) = *ret_ty.kind()
8080
&& let Some(future_trait) = cx.tcx.lang_items().future_trait()
8181
&& let Some(send_trait) = cx.tcx.get_diagnostic_item(sym::Send)
8282
&& let preds = cx.tcx.explicit_item_self_bounds(def_id)
@@ -149,6 +149,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for TyParamAtTopLevelVisitor {
149149
match ty.kind() {
150150
ty::Param(_) => ControlFlow::Break(true),
151151
ty::Alias(
152+
_,
152153
ty @ AliasTy {
153154
kind: ty::Projection { .. },
154155
..

clippy_lints/src/indexing_slicing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ fn ty_has_applicable_get_function<'tcx>(
280280
&& let generic_ty = option_generic_param.expect_ty().peel_refs()
281281
// FIXME: ideally this would handle type params and projections properly, for now just assume it's the same type
282282
&& (cx.typeck_results().expr_ty(index_expr).peel_refs() == generic_ty.peel_refs()
283-
|| matches!(generic_ty.peel_refs().kind(), ty::Param(_) | ty::Alias(_)))
283+
|| matches!(generic_ty.peel_refs().kind(), ty::Param(_) | ty::Alias(_, _)))
284284
{
285285
true
286286
} else {

clippy_lints/src/len_without_is_empty.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,13 @@ fn check_trait_items(cx: &LateContext<'_>, visited_trait: &Item<'_>, ident: Iden
149149
}
150150

151151
fn extract_future_output<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<&'tcx PathSegment<'tcx>> {
152-
if let ty::Alias(ty::AliasTy {
153-
kind: ty::Opaque { def_id },
154-
..
155-
}) = *ty.kind()
152+
if let ty::Alias(
153+
_,
154+
ty::AliasTy {
155+
kind: ty::Opaque { def_id },
156+
..
157+
},
158+
) = *ty.kind()
156159
&& let Some(Node::OpaqueTy(opaque)) = cx.tcx.hir_get_if_local(def_id)
157160
&& let OpaqueTyOrigin::AsyncFn { .. } = opaque.origin
158161
&& let [GenericBound::Trait(trait_ref)] = &opaque.bounds

0 commit comments

Comments
 (0)