mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Don't check sad pattern equality by text
This commit is contained in:
parent
251f0c6090
commit
eb3f90b301
1 changed files with 2 additions and 1 deletions
|
@ -265,10 +265,11 @@ fn binds_name(pat: &ast::Pat) -> bool {
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_sad_pat(sema: &hir::Semantics<RootDatabase>, pat: &ast::Pat) -> bool {
|
fn is_sad_pat(sema: &hir::Semantics<RootDatabase>, pat: &ast::Pat) -> bool {
|
||||||
sema.type_of_pat(pat)
|
sema.type_of_pat(pat)
|
||||||
.and_then(|ty| TryEnum::from_ty(sema, &ty))
|
.and_then(|ty| TryEnum::from_ty(sema, &ty))
|
||||||
.map_or(false, |it| it.sad_pattern().syntax().text() == pat.syntax().text())
|
.map_or(false, |it| does_pat_match_variant(pat, &it.sad_pattern()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue