Open
Description
Code
enum E {
V(),
}
impl E {
#[expect(non_snake_case)]
fn V() {}
}
fn main() {
let _: E = E::V();
}
Current output
warning: associated function `V` is never used
--> src/main.rs:7:8
|
5 | impl E {
| ------ associated function in this implementation
6 | #[expect(non_snake_case)]
7 | fn V() {}
| ^
|
= note: `#[warn(dead_code)]` on by default
Desired output
warning: associated function `V` is never used
--> src/main.rs:7:8
|
5 | impl E {
| ------ associated function in this implementation
6 | #[expect(non_snake_case)]
7 | fn V() {}
| ^
|
= note: `#[warn(dead_code)]` on by default
= note: this function is shadowed by the `E::V` variant and can't be called
Rationale and extra context
Tuple variants always shadow methods. If a method has the same name as a variant it is uncallable.
Rust Version
1.87.0