aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_tt/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_tt/src')
-rw-r--r--crates/ra_tt/src/lib.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs
index 73d8395a8..10f424aae 100644
--- a/crates/ra_tt/src/lib.rs
+++ b/crates/ra_tt/src/lib.rs
@@ -103,7 +103,7 @@ impl fmt::Display for TokenTree {
103 103
104impl fmt::Display for Subtree { 104impl fmt::Display for Subtree {
105 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 105 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
106 let (l, r) = match self.delimiter.map(|it| it.kind) { 106 let (l, r) = match self.delimiter_kind() {
107 Some(DelimiterKind::Parenthesis) => ("(", ")"), 107 Some(DelimiterKind::Parenthesis) => ("(", ")"),
108 Some(DelimiterKind::Brace) => ("{", "}"), 108 Some(DelimiterKind::Brace) => ("{", "}"),
109 Some(DelimiterKind::Bracket) => ("[", "]"), 109 Some(DelimiterKind::Bracket) => ("[", "]"),
@@ -171,6 +171,10 @@ impl Subtree {
171 171
172 self.token_trees.len() + children_count 172 self.token_trees.len() + children_count
173 } 173 }
174
175 pub fn delimiter_kind(&self) -> Option<DelimiterKind> {
176 self.delimiter.map(|it| it.kind)
177 }
174} 178}
175 179
176pub mod buffer; 180pub mod buffer;