2023-07-17 20:10:45 -05:00
|
|
|
//@ run-rustfix
|
|
|
|
|
2024-02-06 20:42:01 -06:00
|
|
|
#![allow(dead_code)]
|
2023-07-17 20:10:45 -05:00
|
|
|
#![deny(unused_qualifications)]
|
|
|
|
#![feature(unsized_fn_params)]
|
|
|
|
|
|
|
|
#[allow(unused_imports)]
|
|
|
|
use std::ops;
|
|
|
|
use std::ops::Index;
|
|
|
|
|
|
|
|
pub struct A;
|
|
|
|
|
|
|
|
impl ops::Index<str> for A {
|
|
|
|
//~^ ERROR unnecessary qualification
|
|
|
|
type Output = ();
|
|
|
|
fn index(&self, _: str) -> &Self::Output {
|
|
|
|
&()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-11 09:39:02 -05:00
|
|
|
// This is used to make `use std::ops::Index;` not unused_import.
|
|
|
|
// details in fix(#122373) for issue #121331
|
|
|
|
pub struct C;
|
|
|
|
impl Index<str> for C {
|
|
|
|
type Output = ();
|
|
|
|
fn index(&self, _: str) -> &Self::Output {
|
|
|
|
&()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-17 20:10:45 -05:00
|
|
|
mod inner {
|
|
|
|
pub trait Trait<T> {}
|
|
|
|
}
|
|
|
|
|
|
|
|
// the import needs to be here for the lint to show up
|
|
|
|
#[allow(unused_imports)]
|
|
|
|
use inner::Trait;
|
|
|
|
|
|
|
|
impl inner::Trait<u8> for () {}
|
|
|
|
//~^ ERROR unnecessary qualification
|
|
|
|
|
2024-03-11 09:39:02 -05:00
|
|
|
impl Trait<A> for A {}
|
2023-07-17 20:10:45 -05:00
|
|
|
fn main() {}
|