Skip to content

Commit ebd2498

Browse files
author
Michael Wright
committed
Rename implitem to impl_item
`impl_item` is proper snake case and used everywhere else.
1 parent c55d38e commit ebd2498

File tree

1 file changed

+12
-12
lines changed
  • clippy_lints/src/methods

1 file changed

+12
-12
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -991,29 +991,29 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
991991
}
992992
}
993993

994-
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, implitem: &'tcx hir::ImplItem) {
995-
if in_external_macro(cx.sess(), implitem.span) {
994+
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem) {
995+
if in_external_macro(cx.sess(), impl_item.span) {
996996
return;
997997
}
998-
let name = implitem.ident.name.as_str();
999-
let parent = cx.tcx.hir().get_parent_item(implitem.hir_id);
998+
let name = impl_item.ident.name.as_str();
999+
let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id);
10001000
let item = cx.tcx.hir().expect_item(parent);
10011001
let def_id = cx.tcx.hir().local_def_id(item.hir_id);
10021002
let ty = cx.tcx.type_of(def_id);
10031003
if_chain! {
1004-
if let hir::ImplItemKind::Method(ref sig, id) = implitem.node;
1004+
if let hir::ImplItemKind::Method(ref sig, id) = impl_item.node;
10051005
if let Some(first_arg_ty) = sig.decl.inputs.get(0);
10061006
if let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.hir().body(id)).next();
10071007
if let hir::ItemKind::Impl(_, _, _, _, None, ref self_ty, _) = item.node;
10081008
then {
1009-
if cx.access_levels.is_exported(implitem.hir_id) {
1009+
if cx.access_levels.is_exported(impl_item.hir_id) {
10101010
// check missing trait implementations
10111011
for &(method_name, n_args, self_kind, out_type, trait_name) in &TRAIT_METHODS {
10121012
if name == method_name &&
10131013
sig.decl.inputs.len() == n_args &&
10141014
out_type.matches(cx, &sig.decl.output) &&
1015-
self_kind.matches(cx, first_arg_ty, first_arg, self_ty, false, &implitem.generics) {
1016-
span_lint(cx, SHOULD_IMPLEMENT_TRAIT, implitem.span, &format!(
1015+
self_kind.matches(cx, first_arg_ty, first_arg, self_ty, false, &impl_item.generics) {
1016+
span_lint(cx, SHOULD_IMPLEMENT_TRAIT, impl_item.span, &format!(
10171017
"defining a method called `{}` on this type; consider implementing \
10181018
the `{}` trait or choosing a less ambiguous name", name, trait_name));
10191019
}
@@ -1026,7 +1026,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
10261026
if conv.check(&name) {
10271027
if !self_kinds
10281028
.iter()
1029-
.any(|k| k.matches(cx, first_arg_ty, first_arg, self_ty, is_copy, &implitem.generics)) {
1029+
.any(|k| k.matches(cx, first_arg_ty, first_arg, self_ty, is_copy, &impl_item.generics)) {
10301030
let lint = if item.vis.node.is_pub() {
10311031
WRONG_PUB_SELF_CONVENTION
10321032
} else {
@@ -1052,8 +1052,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
10521052
}
10531053
}
10541054

1055-
if let hir::ImplItemKind::Method(_, _) = implitem.node {
1056-
let ret_ty = return_ty(cx, implitem.hir_id);
1055+
if let hir::ImplItemKind::Method(_, _) = impl_item.node {
1056+
let ret_ty = return_ty(cx, impl_item.hir_id);
10571057

10581058
// walk the return type and check for Self (this does not check associated types)
10591059
for inner_type in ret_ty.walk() {
@@ -1086,7 +1086,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
10861086
span_lint(
10871087
cx,
10881088
NEW_RET_NO_SELF,
1089-
implitem.span,
1089+
impl_item.span,
10901090
"methods called `new` usually return `Self`",
10911091
);
10921092
}

0 commit comments

Comments
 (0)