Remove invalid lint when there is a generic argument in prefix path

This commit is contained in:
yukang 2023-08-05 15:58:26 +08:00
parent fca59ab5f0
commit c9be1a71b6
2 changed files with 12 additions and 1 deletions

View File

@ -3944,11 +3944,12 @@ fn resolve_qpath(
if path.len() > 1 if path.len() > 1
&& let Some(res) = result.full_res() && let Some(res) = result.full_res()
&& let Some((&last_segment, prev_segs)) = path.split_last()
&& prev_segs.iter().all(|seg| !seg.has_generic_args)
&& res != Res::Err && res != Res::Err
&& path[0].ident.name != kw::PathRoot && path[0].ident.name != kw::PathRoot
&& path[0].ident.name != kw::DollarCrate && path[0].ident.name != kw::DollarCrate
{ {
let last_segment = *path.last().unwrap();
let unqualified_result = { let unqualified_result = {
match self.resolve_path(&[last_segment], Some(ns), None) { match self.resolve_path(&[last_segment], Some(ns), None) {
PathResult::NonModule(path_res) => path_res.expect_full_res(), PathResult::NonModule(path_res) => path_res.expect_full_res(),

View File

@ -0,0 +1,10 @@
#![deny(unused_qualifications)]
// check-pass
fn bar() {
match Option::<Option<()>>::None {
Some(v) => {}
None => {}
}
}
fn main() {}