Skip to content

Commit f6d3106

Browse files
authored
Rustup (#16866)
r? @ghost changelog: none
2 parents 121f867 + 7a69763 commit f6d3106

36 files changed

Lines changed: 134 additions & 63 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.96"
3+
version = "0.1.97"
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.96"
3+
version = "0.1.97"
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.96"
3+
version = "0.1.97"
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/arbitrary_source_item_ordering.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,16 @@ impl<'tcx> LateLintPass<'tcx> for ArbitrarySourceItemOrdering {
306306
cur_f = Some(field);
307307
}
308308
},
309-
ItemKind::Trait(_constness, is_auto, _safety, _ident, _generics, _generic_bounds, item_ref)
310-
if self.enable_ordering_for_trait && *is_auto == IsAuto::No =>
311-
{
309+
ItemKind::Trait(
310+
_constness,
311+
is_auto,
312+
_safety,
313+
_impl_restriction,
314+
_ident,
315+
_generics,
316+
_generic_bounds,
317+
item_ref,
318+
) if self.enable_ordering_for_trait && *is_auto == IsAuto::No => {
312319
let mut cur_t: Option<(TraitItemId, Ident)> = None;
313320

314321
for &item in *item_ref {

clippy_lints/src/cognitive_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'tcx> LateLintPass<'tcx> for CognitiveComplexity {
145145
def_id: LocalDefId,
146146
) {
147147
#[allow(deprecated)]
148-
if !cx.tcx.has_attr(def_id, sym::test) {
148+
if cx.tcx.get_attrs(def_id, sym::test).next().is_none() {
149149
let expr = if kind.asyncness().is_async() {
150150
match get_async_fn_body(cx.tcx, body) {
151151
Some(b) => b,

clippy_lints/src/dereference.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -885,12 +885,21 @@ impl TyCoercionStability {
885885
continue;
886886
},
887887
ty::Param(_) if for_return => Self::Deref,
888-
ty::Alias(ty::Free | ty::Inherent, _) => unreachable!("should have been normalized away above"),
889-
ty::Alias(ty::Projection, _) if !for_return && ty.has_non_region_param() => Self::Reborrow,
888+
ty::Alias(ty::AliasTy {
889+
kind: ty::Free { .. } | ty::Inherent { .. },
890+
..
891+
}) => unreachable!("should have been normalized away above"),
892+
ty::Alias(ty::AliasTy {
893+
kind: ty::Projection { .. },
894+
..
895+
}) if !for_return && ty.has_non_region_param() => Self::Reborrow,
890896
ty::Infer(_)
891897
| ty::Error(_)
892898
| ty::Bound(..)
893-
| ty::Alias(ty::Opaque, ..)
899+
| ty::Alias(ty::AliasTy {
900+
kind: ty::Opaque { .. },
901+
..
902+
})
894903
| ty::Placeholder(_)
895904
| ty::Dynamic(..)
896905
| ty::Param(_) => Self::Reborrow,
@@ -921,7 +930,10 @@ impl TyCoercionStability {
921930
| ty::CoroutineClosure(..)
922931
| ty::Never
923932
| ty::Tuple(_)
924-
| ty::Alias(ty::Projection, _)
933+
| ty::Alias(ty::AliasTy {
934+
kind: ty::Projection { .. },
935+
..
936+
})
925937
| ty::UnsafeBinder(_) => Self::Deref,
926938
};
927939
}

clippy_lints/src/derive/derive_partial_eq_without_eq.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,5 @@ fn typing_env_for_derived_eq(tcx: TyCtxt<'_>, did: DefId, eq_trait_id: DefId) ->
8585
.upcast(tcx)
8686
}),
8787
)));
88-
ty::TypingEnv {
89-
typing_mode: ty::TypingMode::non_body_analysis(),
90-
param_env,
91-
}
88+
ty::TypingEnv::new(param_env, ty::TypingMode::non_body_analysis())
9289
}

clippy_lints/src/from_over_into.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ 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()
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::Opaque, _))
81+
&& !matches!(middle_trait_ref.args.type_at(1).kind(), ty::Alias(ty::AliasTy { kind: ty::Opaque{..} , .. }))
8282
&& self.msrv.meets(cx, msrvs::RE_REBALANCING_COHERENCE)
8383
{
8484
span_lint_and_then(

clippy_lints/src/future_not_send.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
7575
return;
7676
}
7777
let ret_ty = return_ty(cx, cx.tcx.local_def_id_to_hir_id(fn_def_id).expect_owner());
78-
if let ty::Alias(ty::Opaque, AliasTy { def_id, args, .. }) = *ret_ty.kind()
78+
if let ty::Alias(AliasTy { kind: ty::Opaque{def_id}, args, .. }) = *ret_ty.kind()
7979
&& let Some(future_trait) = cx.tcx.lang_items().future_trait()
8080
&& let Some(send_trait) = cx.tcx.get_diagnostic_item(sym::Send)
8181
&& let preds = cx.tcx.explicit_item_self_bounds(def_id)
@@ -148,7 +148,12 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for TyParamAtTopLevelVisitor {
148148
fn visit_ty(&mut self, ty: Ty<'tcx>) -> Self::Result {
149149
match ty.kind() {
150150
ty::Param(_) => ControlFlow::Break(true),
151-
ty::Alias(ty::AliasTyKind::Projection, ty) => ty.visit_with(self),
151+
ty::Alias(
152+
ty @ AliasTy {
153+
kind: ty::Projection { .. },
154+
..
155+
},
156+
) => ty.visit_with(self),
152157
_ => ControlFlow::Break(false),
153158
}
154159
}

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 {

0 commit comments

Comments
 (0)