diff options
Diffstat (limited to 'crates/ra_tt')
-rw-r--r-- | crates/ra_tt/src/lib.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs index 4c00b8f30..e7bfd5fd2 100644 --- a/crates/ra_tt/src/lib.rs +++ b/crates/ra_tt/src/lib.rs | |||
@@ -48,9 +48,9 @@ pub enum Leaf { | |||
48 | } | 48 | } |
49 | impl_froms!(Leaf: Literal, Punct, Ident); | 49 | impl_froms!(Leaf: Literal, Punct, Ident); |
50 | 50 | ||
51 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 51 | #[derive(Debug, Clone, PartialEq, Eq, Hash, Default)] |
52 | pub struct Subtree { | 52 | pub struct Subtree { |
53 | pub delimiter: Delimiter, | 53 | pub delimiter: Option<Delimiter>, |
54 | pub token_trees: Vec<TokenTree>, | 54 | pub token_trees: Vec<TokenTree>, |
55 | } | 55 | } |
56 | 56 | ||
@@ -59,7 +59,6 @@ pub enum Delimiter { | |||
59 | Parenthesis, | 59 | Parenthesis, |
60 | Brace, | 60 | Brace, |
61 | Bracket, | 61 | Bracket, |
62 | None, | ||
63 | } | 62 | } |
64 | 63 | ||
65 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 64 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -97,10 +96,10 @@ impl fmt::Display for TokenTree { | |||
97 | impl fmt::Display for Subtree { | 96 | impl fmt::Display for Subtree { |
98 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | 97 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
99 | let (l, r) = match self.delimiter { | 98 | let (l, r) = match self.delimiter { |
100 | Delimiter::Parenthesis => ("(", ")"), | 99 | Some(Delimiter::Parenthesis) => ("(", ")"), |
101 | Delimiter::Brace => ("{", "}"), | 100 | Some(Delimiter::Brace) => ("{", "}"), |
102 | Delimiter::Bracket => ("[", "]"), | 101 | Some(Delimiter::Bracket) => ("[", "]"), |
103 | Delimiter::None => ("", ""), | 102 | None => ("", ""), |
104 | }; | 103 | }; |
105 | f.write_str(l)?; | 104 | f.write_str(l)?; |
106 | let mut needs_space = false; | 105 | let mut needs_space = false; |