aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-26 12:12:45 +0000
committerGitHub <[email protected]>2021-01-26 12:12:45 +0000
commit3a5cd6bbc60673aaaa62a94839062f870a62777a (patch)
tree8d055c5eaf79e281b139ffb1a1ab9f0ebb144cca /crates/ide_db
parent21660f1d979be43af579277ef487118d68533d41 (diff)
parent5728d7186e64966a20ece3dc479153219a47ba17 (diff)
Merge #7406
7406: if_let_match: don't assume happy path r=matklad a=bugadani Closes #7392 Co-authored-by: Dániel Buga <[email protected]>
Diffstat (limited to 'crates/ide_db')
-rw-r--r--crates/ide_db/src/ty_filter.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ide_db/src/ty_filter.rs b/crates/ide_db/src/ty_filter.rs
index 63a945282..f8406851b 100644
--- a/crates/ide_db/src/ty_filter.rs
+++ b/crates/ide_db/src/ty_filter.rs
@@ -49,6 +49,21 @@ impl TryEnum {
49 } 49 }
50 } 50 }
51 51
52 pub fn happy_pattern(self) -> ast::Pat {
53 match self {
54 TryEnum::Result => make::tuple_struct_pat(
55 make::path_unqualified(make::path_segment(make::name_ref("Ok"))),
56 iter::once(make::wildcard_pat().into()),
57 )
58 .into(),
59 TryEnum::Option => make::tuple_struct_pat(
60 make::path_unqualified(make::path_segment(make::name_ref("Some"))),
61 iter::once(make::wildcard_pat().into()),
62 )
63 .into(),
64 }
65 }
66
52 fn type_name(self) -> &'static str { 67 fn type_name(self) -> &'static str {
53 match self { 68 match self {
54 TryEnum::Result => "Result", 69 TryEnum::Result => "Result",