aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_mbe')
-rw-r--r--crates/ra_mbe/Cargo.toml1
-rw-r--r--crates/ra_mbe/src/lib.rs6
-rw-r--r--crates/ra_mbe/src/mbe_expander/matcher.rs2
-rw-r--r--crates/ra_mbe/src/parser.rs5
4 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_mbe/Cargo.toml b/crates/ra_mbe/Cargo.toml
index 4dec24914..a26746a19 100644
--- a/crates/ra_mbe/Cargo.toml
+++ b/crates/ra_mbe/Cargo.toml
@@ -3,6 +3,7 @@ edition = "2018"
3name = "ra_mbe" 3name = "ra_mbe"
4version = "0.1.0" 4version = "0.1.0"
5authors = ["rust-analyzer developers"] 5authors = ["rust-analyzer developers"]
6license = "MIT OR Apache-2.0"
6 7
7[lib] 8[lib]
8doctest = false 9doctest = false
diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs
index 9c450eaba..dec7ba22e 100644
--- a/crates/ra_mbe/src/lib.rs
+++ b/crates/ra_mbe/src/lib.rs
@@ -9,6 +9,9 @@ mod syntax_bridge;
9mod tt_iter; 9mod tt_iter;
10mod subtree_source; 10mod subtree_source;
11 11
12#[cfg(test)]
13mod tests;
14
12pub use tt::{Delimiter, Punct}; 15pub use tt::{Delimiter, Punct};
13 16
14use crate::{ 17use crate::{
@@ -273,6 +276,3 @@ impl<T: Default> From<Result<T, ExpandError>> for ExpandResult<T> {
273 .map_or_else(|e| ExpandResult(Default::default(), Some(e)), |it| ExpandResult(it, None)) 276 .map_or_else(|e| ExpandResult(Default::default(), Some(e)), |it| ExpandResult(it, None))
274 } 277 }
275} 278}
276
277#[cfg(test)]
278mod tests;
diff --git a/crates/ra_mbe/src/mbe_expander/matcher.rs b/crates/ra_mbe/src/mbe_expander/matcher.rs
index 78f9efa1b..f9e515b81 100644
--- a/crates/ra_mbe/src/mbe_expander/matcher.rs
+++ b/crates/ra_mbe/src/mbe_expander/matcher.rs
@@ -260,7 +260,7 @@ impl<'a> TtIter<'a> {
260 | ('|', '=', None) 260 | ('|', '=', None)
261 | ('|', '|', None) => { 261 | ('|', '|', None) => {
262 let tt2 = self.next().unwrap().clone(); 262 let tt2 = self.next().unwrap().clone();
263 Ok(tt::Subtree { delimiter: None, token_trees: vec![tt.clone(), tt2] }.into()) 263 Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2] }.into())
264 } 264 }
265 _ => Ok(tt), 265 _ => Ok(tt),
266 } 266 }
diff --git a/crates/ra_mbe/src/parser.rs b/crates/ra_mbe/src/parser.rs
index 034150432..1e5dafbdf 100644
--- a/crates/ra_mbe/src/parser.rs
+++ b/crates/ra_mbe/src/parser.rs
@@ -137,10 +137,7 @@ fn eat_fragment_kind<'a>(
137} 137}
138 138
139fn is_boolean_literal(lit: &tt::Literal) -> bool { 139fn is_boolean_literal(lit: &tt::Literal) -> bool {
140 match lit.text.as_str() { 140 matches!(lit.text.as_str(), "true" | "false")
141 "true" | "false" => true,
142 _ => false,
143 }
144} 141}
145 142
146fn parse_repeat(src: &mut TtIter) -> Result<(Option<Separator>, RepeatKind), ExpandError> { 143fn parse_repeat(src: &mut TtIter) -> Result<(Option<Separator>, RepeatKind), ExpandError> {