UNUSED_QUALIFICATIONS in rustc_lint_defs::builtin - Rust
Description: The `unused_qualifications` lint detects unnecessarily qualified names.

Skip to main content

## UNUSED_QUALIFICATIONS

# Static UNUSED_QUALIFICATIONS

Source

    pub static UNUSED_QUALIFICATIONS: &Lint

Expand description

The `unused_qualifications` lint detects unnecessarily qualified names.

#### §Example

ⓘ

    #![deny(unused_qualifications)]
    mod foo {
        pub fn bar() {}
    }

    fn main() {
        use foo::bar;
        foo::bar();
        bar();
    }

{{produces}}

#### §Explanation

If an item from another module is already brought into scope, then there is no need to qualify it in this case. You can call `bar()` directly, without the `foo::`.

This lint is “allow” by default because it is somewhat pedantic, and doesn’t indicate an actual problem, but rather a stylistic choice, and can be noisy when refactoring or moving around code.