//@ run-rustfix #![allow(dead_code)] #![deny(unused_qualifications)] #![feature(unsized_fn_params)] #[allow(unused_imports)] use std::ops; use std::ops::Index; pub struct A; impl ops::Index for A { //~^ ERROR unnecessary qualification type Output = (); fn index(&self, _: str) -> &Self::Output { &() } } // This is used to make `use std::ops::Index;` not unused_import. // details in fix(#122373) for issue #121331 pub struct C; impl Index for C { type Output = (); fn index(&self, _: str) -> &Self::Output { &() } } mod inner { pub trait Trait {} } // the import needs to be here for the lint to show up #[allow(unused_imports)] use inner::Trait; impl inner::Trait for () {} //~^ ERROR unnecessary qualification impl Trait for A {} fn main() {}