Skip to content

Commit c936595

Browse files
authored
r? @ghost changelog: none
2 parents 0b784f8 + a531040 commit c936595

File tree

88 files changed

+303
-314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+303
-314
lines changed

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.92"
3+
version = "0.1.93"
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.92"
3+
version = "0.1.93"
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.92"
3+
version = "0.1.93"
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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,6 @@ fn get_item_name(item: &Item<'_>) -> Option<String> {
550550
// This case doesn't exist in the clippy tests codebase.
551551
None
552552
},
553-
QPath::LangItem(_, _) => None,
554553
}
555554
} else {
556555
// Impls for anything that isn't a named type can be skipped.

clippy_lints/src/derive/derive_ord_xor_partial_ord.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(super) fn check<'tcx>(
2828
return;
2929
}
3030

31-
let trait_ref = cx.tcx.impl_trait_ref(impl_id).expect("must be a trait implementation");
31+
let trait_ref = cx.tcx.impl_trait_ref(impl_id);
3232

3333
// Only care about `impl PartialOrd<Foo> for Foo`
3434
// For `impl PartialOrd<B> for A, input_types is [A, B]

clippy_lints/src/derive/derived_hash_with_manual_eq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub(super) fn check<'tcx>(
2727
return;
2828
}
2929

30-
let trait_ref = cx.tcx.impl_trait_ref(impl_id).expect("must be a trait implementation");
30+
let trait_ref = cx.tcx.impl_trait_ref(impl_id);
3131

3232
// Only care about `impl PartialEq<Foo> for Foo`
3333
// For `impl PartialEq<B> for A, input_types is [A, B]

clippy_lints/src/fallible_impl_from.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,9 @@ declare_lint_pass!(FallibleImplFrom => [FALLIBLE_IMPL_FROM]);
5252
impl<'tcx> LateLintPass<'tcx> for FallibleImplFrom {
5353
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
5454
// check for `impl From<???> for ..`
55-
if let hir::ItemKind::Impl(_) = &item.kind
56-
&& let Some(impl_trait_ref) = cx.tcx.impl_trait_ref(item.owner_id)
57-
&& cx
58-
.tcx
59-
.is_diagnostic_item(sym::From, impl_trait_ref.skip_binder().def_id)
55+
if let hir::ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }) = &item.kind
56+
&& let impl_trait_id = cx.tcx.impl_trait_id(item.owner_id)
57+
&& cx.tcx.is_diagnostic_item(sym::From, impl_trait_id)
6058
{
6159
lint_impl_body(cx, item.owner_id, item.span);
6260
}

clippy_lints/src/four_forward_slashes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'tcx> LateLintPass<'tcx> for FourForwardSlashes {
4747
.tcx
4848
.hir_attrs(item.hir_id())
4949
.iter()
50-
.filter(|i| i.is_doc_comment())
50+
.filter(|i| i.is_doc_comment().is_some())
5151
.fold(item.span.shrink_to_lo(), |span, attr| span.to(attr.span()));
5252
let (Some(file), _, _, end_line, _) = sm.span_to_location_info(span) else {
5353
return;

clippy_lints/src/from_over_into.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ impl<'tcx> LateLintPass<'tcx> for FromOverInto {
7676
// `impl Into<target_ty> for self_ty`
7777
&& let Some(GenericArgs { args: [GenericArg::Type(target_ty)], .. }) = into_trait_seg.args
7878
&& span_is_local(item.span)
79-
&& let Some(middle_trait_ref) = cx.tcx.impl_trait_ref(item.owner_id)
80-
.map(ty::EarlyBinder::instantiate_identity)
79+
&& let middle_trait_ref = cx.tcx.impl_trait_ref(item.owner_id).instantiate_identity()
8180
&& cx.tcx.is_diagnostic_item(sym::Into, middle_trait_ref.def_id)
8281
&& !matches!(middle_trait_ref.args.type_at(1).kind(), ty::Alias(ty::Opaque, _))
8382
&& self.msrv.meets(cx, msrvs::RE_REBALANCING_COHERENCE)

clippy_lints/src/implicit_saturating_sub.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,7 @@ fn check_with_condition<'tcx>(
339339
ExprKind::Path(QPath::TypeRelative(_, name)) => {
340340
if name.ident.name == sym::MIN
341341
&& let Some(const_id) = cx.typeck_results().type_dependent_def_id(cond_num_val.hir_id)
342-
&& let Some(impl_id) = cx.tcx.impl_of_assoc(const_id)
343-
&& let None = cx.tcx.impl_trait_ref(impl_id) // An inherent impl
342+
&& let Some(impl_id) = cx.tcx.inherent_impl_of_assoc(const_id)
344343
&& cx.tcx.type_of(impl_id).instantiate_identity().is_integral()
345344
{
346345
print_lint_and_sugg(cx, var_name, expr);
@@ -350,8 +349,7 @@ fn check_with_condition<'tcx>(
350349
if let ExprKind::Path(QPath::TypeRelative(_, name)) = func.kind
351350
&& name.ident.name == sym::min_value
352351
&& let Some(func_id) = cx.typeck_results().type_dependent_def_id(func.hir_id)
353-
&& let Some(impl_id) = cx.tcx.impl_of_assoc(func_id)
354-
&& let None = cx.tcx.impl_trait_ref(impl_id) // An inherent impl
352+
&& let Some(impl_id) = cx.tcx.inherent_impl_of_assoc(func_id)
355353
&& cx.tcx.type_of(impl_id).instantiate_identity().is_integral()
356354
{
357355
print_lint_and_sugg(cx, var_name, expr);

0 commit comments

Comments
 (0)