Closed
Description
Summary
#![deny(unused_qualifications)] does not work in match block.
Lint Name
#![deny(unused_qualifications)]
Reproducer
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::Ok;
let resp = status::Resp{status: st};
match resp.status() {
status::StatusCode::Ok => {Ok(())} // lint should warn but not
status::StatusCode::NotFound => {Ok(())} // lint should warn but not
}
}
// status.rs
#[derive(Clone)]
pub enum StatusCode {
Ok,
NotFound,
}
pub struct Resp {
pub(crate) status: StatusCode,
}
impl Resp {
pub fn status(&self) -> StatusCode {
self.status.clone()
}
}
run the following cmd:
cargo clippy
I expected to see this happen:
error: unnecessary qualification
Instead, this happened:
no error
Version
rustc 1.62.1 (e092d0b6b 2022-07-16)
binary: rustc
commit-hash: e092d0b6b43f2de967af0887873151bb1c0b18d3
commit-date: 2022-07-16
host: x86_64-apple-darwin
release: 1.62.1
LLVM version: 14.0.5