Skip to content

clippy::multiple_inherent_impl should flag generic impl blocks with the same bounds #16283

@joshtriplett

Description

@joshtriplett

Summary

multiple_inherent_impl only seems to flag multiple impl blocks for types with no generics, and ignores impl blocks for types with generics.

Lint Name

multiple_inherent_impl

Reproducer

I tried this code:

use std::fmt::Debug;

#[derive(Debug)]
struct S<T: Debug>(T);

impl<T: Debug> S<T> {
    fn make_one(one: T) -> Self { Self(one) }
}

impl<T: Debug> S<T> {
    fn make_two(two: T) -> Self { Self(two) }
}

fn main() {
    let s1 = S::make_one(1u32);
    let s2 = S::make_two(2u64);
    println!("Hello, world! {s1:?} {s2:?}");
}

I expected this to produce a warning on the multiple impl blocks, but it didn't.

Version

rustc 1.92.0 (ded5c06cf 2025-12-08)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: x86_64-unknown-linux-gnu
release: 1.92.0
LLVM version: 21.1.3

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions