Skip to content

type-repetition-in-bounds gives an unhelpful suggestion when lifetimes are involved #14744

Open
@Kriskras99

Description

@Kriskras99

Summary

The suggestion for type-repetition-in-bounds is unclear if the duplication is because of a lifetime.

Reproducer

I tried this code:

struct Struct<'a, K: 'a>
where K: Clone {
    phantom: std::marker::PhantomData<&'a K>,
}

I expected to see this happen:

help: consider combining the bounds: `K: 'a + Clone`

(or no warning at all)
Instead, this happened:

help: consider combining the bounds: `K: Clone`

Version

rustc: 1.88.0-nightly (d6a325d93 2025-05-03)
binary: rustc
commit-hash: d6a325d93a84077580c677f89affbe45682606c3
commit-date: 2025-05-03
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.4

Additional Labels

No response

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingL-nurseryLint: Currently in the nursery group

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions