Skip to content

Commit 86ff11e

Browse files
committed
Rename impl_of_method -> impl_of_assoc
1 parent b074019 commit 86ff11e

25 files changed

+27
-27
lines changed

clippy_lints/src/assigning_clones.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for AssigningClones {
9898
// That is overly conservative - the lint should fire even if there was no initializer,
9999
// but the variable has been initialized before `lhs` was evaluated.
100100
&& path_to_local(lhs).is_none_or(|lhs| local_is_initialized(cx, lhs))
101-
&& let Some(resolved_impl) = cx.tcx.impl_of_method(resolved_fn.def_id())
101+
&& let Some(resolved_impl) = cx.tcx.impl_of_assoc(resolved_fn.def_id())
102102
// Derived forms don't implement `clone_from`/`clone_into`.
103103
// See https://github.com/rust-lang/rust/pull/98445#issuecomment-1190681305
104104
&& !cx.tcx.is_builtin_derived(resolved_impl)

clippy_lints/src/casts/cast_ptr_alignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn is_used_as_unaligned(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
6363
ExprKind::MethodCall(name, self_arg, ..) if self_arg.hir_id == e.hir_id => {
6464
if matches!(name.ident.name, sym::read_unaligned | sym::write_unaligned)
6565
&& let Some(def_id) = cx.typeck_results().type_dependent_def_id(parent.hir_id)
66-
&& let Some(def_id) = cx.tcx.impl_of_method(def_id)
66+
&& let Some(def_id) = cx.tcx.impl_of_assoc(def_id)
6767
&& cx.tcx.type_of(def_id).instantiate_identity().is_raw_ptr()
6868
{
6969
true

clippy_lints/src/casts/confusing_method_to_numeric_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn get_const_name_and_ty_name(
3737
} else {
3838
return None;
3939
}
40-
} else if let Some(impl_id) = cx.tcx.impl_of_method(method_def_id)
40+
} else if let Some(impl_id) = cx.tcx.impl_of_assoc(method_def_id)
4141
&& let Some(ty_name) = get_primitive_ty_name(cx.tcx.type_of(impl_id).instantiate_identity())
4242
&& matches!(
4343
method_name,

clippy_lints/src/implicit_saturating_sub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +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_method(const_id)
342+
&& let Some(impl_id) = cx.tcx.impl_of_assoc(const_id)
343343
&& let None = cx.tcx.impl_trait_ref(impl_id) // An inherent impl
344344
&& cx.tcx.type_of(impl_id).instantiate_identity().is_integral()
345345
{
@@ -350,7 +350,7 @@ fn check_with_condition<'tcx>(
350350
if let ExprKind::Path(QPath::TypeRelative(_, name)) = func.kind
351351
&& name.ident.name == sym::min_value
352352
&& let Some(func_id) = cx.typeck_results().type_dependent_def_id(func.hir_id)
353-
&& let Some(impl_id) = cx.tcx.impl_of_method(func_id)
353+
&& let Some(impl_id) = cx.tcx.impl_of_assoc(func_id)
354354
&& let None = cx.tcx.impl_trait_ref(impl_id) // An inherent impl
355355
&& cx.tcx.type_of(impl_id).instantiate_identity().is_integral()
356356
{

clippy_lints/src/methods/bytes_count_to_len.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub(super) fn check<'tcx>(
1414
bytes_recv: &'tcx hir::Expr<'_>,
1515
) {
1616
if let Some(bytes_id) = cx.typeck_results().type_dependent_def_id(count_recv.hir_id)
17-
&& let Some(impl_id) = cx.tcx.impl_of_method(bytes_id)
17+
&& let Some(impl_id) = cx.tcx.impl_of_assoc(bytes_id)
1818
&& cx.tcx.type_of(impl_id).instantiate_identity().is_str()
1919
&& let ty = cx.typeck_results().expr_ty(bytes_recv).peel_refs()
2020
&& (ty.is_str() || is_type_lang_item(cx, ty, hir::LangItem::String))

clippy_lints/src/methods/case_sensitive_file_extension_comparisons.rs

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

3232
if let Some(method_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id)
33-
&& let Some(impl_id) = cx.tcx.impl_of_method(method_id)
33+
&& let Some(impl_id) = cx.tcx.impl_of_assoc(method_id)
3434
&& cx.tcx.type_of(impl_id).instantiate_identity().is_str()
3535
&& let ExprKind::Lit(Spanned {
3636
node: LitKind::Str(ext_literal, ..),

clippy_lints/src/methods/get_first.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(super) fn check<'tcx>(
1818
arg: &'tcx hir::Expr<'_>,
1919
) {
2020
if let Some(method_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id)
21-
&& let Some(impl_id) = cx.tcx.impl_of_method(method_id)
21+
&& let Some(impl_id) = cx.tcx.impl_of_assoc(method_id)
2222
&& let identity = cx.tcx.type_of(impl_id).instantiate_identity()
2323
&& let hir::ExprKind::Lit(Spanned {
2424
node: LitKind::Int(Pu128(0), _),

clippy_lints/src/methods/implicit_clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn is_clone_like(cx: &LateContext<'_>, method_name: Symbol, method_def_id: h
5050
sym::to_path_buf => is_diag_item_method(cx, method_def_id, sym::Path),
5151
sym::to_vec => cx
5252
.tcx
53-
.impl_of_method(method_def_id)
53+
.impl_of_assoc(method_def_id)
5454
.filter(|&impl_did| {
5555
cx.tcx.type_of(impl_did).instantiate_identity().is_slice() && cx.tcx.impl_trait_ref(impl_did).is_none()
5656
})

clippy_lints/src/methods/manual_ok_or.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(super) fn check<'tcx>(
1818
map_expr: &'tcx Expr<'_>,
1919
) {
2020
if let Some(method_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id)
21-
&& let Some(impl_id) = cx.tcx.impl_of_method(method_id)
21+
&& let Some(impl_id) = cx.tcx.impl_of_assoc(method_id)
2222
&& is_type_diagnostic_item(cx, cx.tcx.type_of(impl_id).instantiate_identity(), sym::Option)
2323
&& let ExprKind::Call(err_path, [err_arg]) = or_expr.kind
2424
&& is_res_lang_ctor(cx, path_res(cx, err_path), ResultErr)

clippy_lints/src/methods/map_clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn should_run_lint(cx: &LateContext<'_>, e: &hir::Expr<'_>, method_id: DefId) ->
2323
return true;
2424
}
2525
// We check if it's an `Option` or a `Result`.
26-
if let Some(id) = cx.tcx.impl_of_method(method_id) {
26+
if let Some(id) = cx.tcx.impl_of_assoc(method_id) {
2727
let identity = cx.tcx.type_of(id).instantiate_identity();
2828
if !is_type_diagnostic_item(cx, identity, sym::Option) && !is_type_diagnostic_item(cx, identity, sym::Result) {
2929
return false;

0 commit comments

Comments
 (0)