diff options
author | Edwin Cheng <[email protected]> | 2019-12-18 03:47:26 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-12-18 05:10:37 +0000 |
commit | 41544a40883874553f570e2999bf56d172bd6246 (patch) | |
tree | b45d7619b97cc6edaf6bcf7d1a42366879bdd703 /crates/ra_tt/src | |
parent | 2ea1cfd7804dd57d63196e71f66c22e56cfd79a8 (diff) |
Refactoring
Diffstat (limited to 'crates/ra_tt/src')
-rw-r--r-- | crates/ra_tt/src/lib.rs | 6 |
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 | ||
104 | impl fmt::Display for Subtree { | 104 | impl 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 | ||
176 | pub mod buffer; | 180 | pub mod buffer; |