Skip to content

Commit eb3f90b

Browse files
committed
Don't check sad pattern equality by text
1 parent 251f0c6 commit eb3f90b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/ide_assists/src/handlers/replace_if_let_with_match.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,11 @@ fn binds_name(pat: &ast::Pat) -> bool {
265265
_ => false,
266266
}
267267
}
268+
268269
fn is_sad_pat(sema: &hir::Semantics<RootDatabase>, pat: &ast::Pat) -> bool {
269270
sema.type_of_pat(pat)
270271
.and_then(|ty| TryEnum::from_ty(sema, &ty))
271-
.map_or(false, |it| it.sad_pattern().syntax().text() == pat.syntax().text())
272+
.map_or(false, |it| does_pat_match_variant(pat, &it.sad_pattern()))
272273
}
273274

274275
#[cfg(test)]

0 commit comments

Comments
 (0)