rust/tests/ui/lint/unqualified_local_imports.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
686 B
Rust
Raw Normal View History

2024-05-28 01:53:08 -05:00
//@compile-flags: --edition 2018
#![feature(unqualified_local_imports)]
#![deny(unqualified_local_imports)]
mod localmod {
pub struct S;
pub struct T;
}
// Not a local import, so no lint.
use std::cell::Cell;
// Implicitly local import, gets lint.
use localmod::S; //~ERROR: unqualified
// Explicitly local import, no lint.
use self::localmod::T;
macro_rules! mymacro {
($cond:expr) => {
if !$cond {
continue;
}
};
}
// Macro import: no lint, as there is no other way to write it.
pub(crate) use mymacro;
#[allow(unused)]
enum LocalEnum {
VarA,
VarB,
}
fn main() {
// Import in a function, no lint.
use LocalEnum::*;
}