Closed
Description
unused_qualifications lint does not work on import path prefix.
I tried this code:
tree:
|- main.rs
|- status.rs
// main.rs
#![deny(unused_qualifications)]
#![allow(dead_code)]
mod status;
use status::StatusCode;
fn main() -> anyhow::Result<()> {
let st = StatusCode::Success;
let resp = status::Resp{status: st};
match resp.status() {
status::StatusCode::Success => {Ok(())} // expect a warn but not
status::StatusCode::NotFound => {Ok(())} // expect a warn but not
}
}
// status.rs
#[derive(Clone)]
pub enum StatusCode {
Success,
NotFound,
}
pub struct Resp {
pub(crate) status: StatusCode,
}
impl Resp {
pub fn status(&self) -> StatusCode {
self.status.clone()
}
}
I expected to see this happen: explanation
error: unnecessary qualification
--> src/main.rs:13:9
|
13 | status::StatusCode::Success => {Ok(())}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Instead, this happened: explanation
no error
Meta
rustc --version --verbose
:
rustc 1.65.0-nightly (addacb587 2022-08-24)
binary: rustc
commit-hash: addacb5878b9970ebc1665768a05cb601e7aea15
commit-date: 2022-08-24
host: x86_64-apple-darwin
release: 1.65.0-nightly
LLVM version: 15.0.0
However, the code is warned in Clion with Rust plugin (version 0.4.176.4815-222):
Backtrace
<backtrace>