aboutsummaryrefslogtreecommitdiff
path: root/crates/mbe/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/mbe/src/lib.rs')
-rw-r--r--crates/mbe/src/lib.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/mbe/src/lib.rs b/crates/mbe/src/lib.rs
index 8c8528aaf..fcc596756 100644
--- a/crates/mbe/src/lib.rs
+++ b/crates/mbe/src/lib.rs
@@ -135,7 +135,7 @@ impl Shift {
135 135
136 /// Shift given TokenTree token id 136 /// Shift given TokenTree token id
137 fn shift_all(self, tt: &mut tt::Subtree) { 137 fn shift_all(self, tt: &mut tt::Subtree) {
138 for t in tt.token_trees.iter_mut() { 138 for t in &mut tt.token_trees {
139 match t { 139 match t {
140 tt::TokenTree::Leaf(leaf) => match leaf { 140 tt::TokenTree::Leaf(leaf) => match leaf {
141 tt::Leaf::Ident(ident) => ident.id = self.shift(ident.id), 141 tt::Leaf::Ident(ident) => ident.id = self.shift(ident.id),
@@ -188,7 +188,7 @@ impl MacroRules {
188 } 188 }
189 } 189 }
190 190
191 for rule in rules.iter() { 191 for rule in &rules {
192 validate(&rule.lhs)?; 192 validate(&rule.lhs)?;
193 } 193 }
194 194
@@ -241,7 +241,7 @@ impl MacroDef {
241 } 241 }
242 rules.push(rule); 242 rules.push(rule);
243 } 243 }
244 for rule in rules.iter() { 244 for rule in &rules {
245 validate(&rule.lhs)?; 245 validate(&rule.lhs)?;
246 } 246 }
247 247
@@ -268,7 +268,7 @@ impl MacroDef {
268} 268}
269 269
270impl Rule { 270impl Rule {
271 fn parse(src: &mut TtIter, expect_arrow: bool) -> Result<Rule, ParseError> { 271 fn parse(src: &mut TtIter, expect_arrow: bool) -> Result<Self, ParseError> {
272 let lhs = src 272 let lhs = src
273 .expect_subtree() 273 .expect_subtree()
274 .map_err(|()| ParseError::Expected("expected subtree".to_string()))?; 274 .map_err(|()| ParseError::Expected("expected subtree".to_string()))?;
@@ -356,7 +356,7 @@ impl<T> ExpandResult<T> {
356 } 356 }
357 357
358 pub fn result(self) -> Result<T, ExpandError> { 358 pub fn result(self) -> Result<T, ExpandError> {
359 self.err.map(Err).unwrap_or(Ok(self.value)) 359 self.err.map_or(Ok(self.value), Err)
360 } 360 }
361} 361}
362 362