2024-02-16 14:02:50 -06:00
|
|
|
//@ run-rustfix
|
2023-07-17 20:10:45 -05:00
|
|
|
#![deny(unused_qualifications)]
|
2024-03-11 09:39:02 -05:00
|
|
|
#![deny(unused_imports)]
|
2024-02-23 11:00:50 -06:00
|
|
|
#![allow(deprecated, dead_code)]
|
2023-07-17 20:10:45 -05:00
|
|
|
|
|
|
|
mod foo {
|
|
|
|
pub fn bar() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
use foo::bar;
|
|
|
|
bar(); //~ ERROR: unnecessary qualification
|
2024-02-23 11:00:50 -06:00
|
|
|
bar(); //~ ERROR: unnecessary qualification
|
2023-07-17 20:10:45 -05:00
|
|
|
bar();
|
|
|
|
|
|
|
|
let _ = || -> Result<(), ()> { try!(Ok(())); Ok(()) }; // issue #37345
|
|
|
|
|
2024-02-23 11:00:50 -06:00
|
|
|
let _ = String::new(); //~ ERROR: unnecessary qualification
|
|
|
|
|
|
|
|
let _: Vec<String> = Vec::<String>::new();
|
|
|
|
//~^ ERROR: unnecessary qualification
|
|
|
|
//~| ERROR: unnecessary qualification
|
|
|
|
|
2024-03-11 09:39:02 -05:00
|
|
|
|
|
|
|
//~^ ERROR: unused import: `std::fmt`
|
|
|
|
let _: std::fmt::Result = Ok(());
|
|
|
|
// don't report unnecessary qualification because fix(#122373) for issue #121331
|
2024-02-23 11:00:50 -06:00
|
|
|
|
2024-03-15 09:59:05 -05:00
|
|
|
let _ = <bool as Default>::default(); // issue #121999 (modified)
|
2024-03-05 12:31:32 -06:00
|
|
|
//~^ ERROR: unnecessary qualification
|
|
|
|
|
2024-02-23 11:00:50 -06:00
|
|
|
macro_rules! m { ($a:ident, $b:ident) => {
|
2023-07-17 20:10:45 -05:00
|
|
|
$crate::foo::bar(); // issue #37357
|
|
|
|
::foo::bar(); // issue #38682
|
2024-02-23 11:00:50 -06:00
|
|
|
foo::bar();
|
|
|
|
foo::$b(); // issue #96698
|
|
|
|
$a::bar();
|
2024-03-15 09:00:08 -05:00
|
|
|
$a::$b();
|
2023-07-17 20:10:45 -05:00
|
|
|
} }
|
2024-02-23 11:00:50 -06:00
|
|
|
m!(foo, bar);
|
|
|
|
}
|
|
|
|
|
|
|
|
mod conflicting_names {
|
|
|
|
mod std {}
|
|
|
|
mod cell {}
|
|
|
|
|
|
|
|
fn f() {
|
|
|
|
let _ = ::std::env::current_dir();
|
|
|
|
let _ = core::cell::Cell::new(1);
|
|
|
|
}
|
2023-07-17 20:10:45 -05:00
|
|
|
}
|