Skip to content

Commit adceb5f

Browse files
committed
restriction
1 parent c81cd9a commit adceb5f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

clippy_lints/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10551055
LintId::of(panic_unimplemented::UNIMPLEMENTED),
10561056
LintId::of(panic_unimplemented::UNREACHABLE),
10571057
LintId::of(pattern_type_mismatch::PATTERN_TYPE_MISMATCH),
1058+
LintId::of(same_name_method::SAME_NAME_METHOD),
10581059
LintId::of(shadow::SHADOW_REUSE),
10591060
LintId::of(shadow::SHADOW_SAME),
10601061
LintId::of(strings::STRING_ADD),
@@ -1146,7 +1147,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11461147
LintId::of(ranges::RANGE_PLUS_ONE),
11471148
LintId::of(redundant_else::REDUNDANT_ELSE),
11481149
LintId::of(ref_option_ref::REF_OPTION_REF),
1149-
LintId::of(same_name_method::SAME_NAME_METHOD),
11501150
LintId::of(semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED),
11511151
LintId::of(shadow::SHADOW_UNRELATED),
11521152
LintId::of(strings::STRING_ADD_ASSIGN),

clippy_lints/src/same_name_method.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ declare_clippy_lint! {
3434
/// }
3535
/// ```
3636
pub SAME_NAME_METHOD,
37-
pedantic,
37+
restriction,
3838
"two method with same name"
3939
}
4040

4141
declare_lint_pass!(SameNameMethod => [SAME_NAME_METHOD]);
4242

43-
struct S {
43+
struct ExistingName {
4444
impl_methods: BTreeMap<SymbolStr, Span>,
4545
trait_methods: BTreeMap<SymbolStr, Vec<Span>>,
4646
}
4747

4848
impl<'tcx> LateLintPass<'tcx> for SameNameMethod {
4949
fn check_crate_post(&mut self, cx: &LateContext<'tcx>, krate: &'tcx Crate<'tcx>) {
50-
let mut mp = FxHashMap::<Res, S>::default();
50+
let mut map = FxHashMap::<Res, ExistingName>::default();
5151

5252
for item in krate.items() {
5353
if let ItemKind::Impl(Impl {
@@ -58,16 +58,16 @@ impl<'tcx> LateLintPass<'tcx> for SameNameMethod {
5858
}) = &item.kind
5959
{
6060
if let TyKind::Path(QPath::Resolved(_, Path { res, .. })) = self_ty.kind {
61-
if !mp.contains_key(res) {
62-
mp.insert(
61+
if !map.contains_key(res) {
62+
map.insert(
6363
*res,
64-
S {
64+
ExistingName {
6565
impl_methods: BTreeMap::new(),
6666
trait_methods: BTreeMap::new(),
6767
},
6868
);
6969
}
70-
let s = mp.get_mut(res).unwrap();
70+
let s = map.get_mut(res).unwrap();
7171

7272
match of_trait {
7373
Some(trait_ref) => {

0 commit comments

Comments
 (0)