Closed
Description
Here (playground):
#![crate_type = "rlib"]
#![deny(clippy::pedantic)]
pub struct Foo;
pub struct Bar([usize; 3]);
impl Foo {
pub const BAR: usize = 3;
pub fn foo() {
const _X: usize = Foo::BAR;
// const _Y: usize = Self::BAR;
}
}
this example compiles, but clippy errors with
error: unnecessary structure name repetition
--> src/lib.rs:11:27
|
11 | const _X: usize = Foo::BAR;
| ^^^ help: use the applicable keyword: `Self`
|
Applying the proposed fix results in a compilation error:
error[E0401]: can't use type parameters from outer function
--> src/lib.rs:12:27
|
7 | impl Foo {
| ---- `Self` type implicitly declared here, by this `impl`
...
12 | const _X: usize = Self::BAR;
| ^^^^^^^^^
| |
| use of type variable from outer function
| use a type here instead
error: aborting due to previous error