aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src/parser.rs
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-02-18 12:53:02 +0000
committerKirill Bulatov <[email protected]>2020-02-18 14:03:08 +0000
commitb8ddcb0652f3ec8683023afc1e1f5166d6a712f4 (patch)
treeea95a1e2083280d84e99f274e5b2b8b269545297 /crates/ra_mbe/src/parser.rs
parenteab80cd961919b9321e1d34343ae3f3adb0502e5 (diff)
Run cargo +nightly fix --clippy -Z unstable-options
Diffstat (limited to 'crates/ra_mbe/src/parser.rs')
-rw-r--r--crates/ra_mbe/src/parser.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_mbe/src/parser.rs b/crates/ra_mbe/src/parser.rs
index 50b8011a9..1cdebc216 100644
--- a/crates/ra_mbe/src/parser.rs
+++ b/crates/ra_mbe/src/parser.rs
@@ -100,7 +100,7 @@ fn next_op<'a>(
100 Op::Repeat { subtree, separator, kind } 100 Op::Repeat { subtree, separator, kind }
101 } 101 }
102 tt::TokenTree::Leaf(leaf) => match leaf { 102 tt::TokenTree::Leaf(leaf) => match leaf {
103 tt::Leaf::Punct(..) => Err(ExpandError::UnexpectedToken)?, 103 tt::Leaf::Punct(..) => return Err(ExpandError::UnexpectedToken),
104 tt::Leaf::Ident(ident) => { 104 tt::Leaf::Ident(ident) => {
105 let name = &ident.text; 105 let name = &ident.text;
106 let kind = eat_fragment_kind(src, mode)?; 106 let kind = eat_fragment_kind(src, mode)?;
@@ -147,15 +147,15 @@ fn parse_repeat(src: &mut TtIter) -> Result<(Option<Separator>, RepeatKind), Exp
147 for tt in src { 147 for tt in src {
148 let tt = match tt { 148 let tt = match tt {
149 tt::TokenTree::Leaf(leaf) => leaf, 149 tt::TokenTree::Leaf(leaf) => leaf,
150 tt::TokenTree::Subtree(_) => Err(ExpandError::InvalidRepeat)?, 150 tt::TokenTree::Subtree(_) => return Err(ExpandError::InvalidRepeat),
151 }; 151 };
152 let has_sep = match &separator { 152 let has_sep = match &separator {
153 Separator::Puncts(puncts) => puncts.len() != 0, 153 Separator::Puncts(puncts) => !puncts.is_empty(),
154 _ => true, 154 _ => true,
155 }; 155 };
156 match tt { 156 match tt {
157 tt::Leaf::Ident(_) | tt::Leaf::Literal(_) if has_sep => { 157 tt::Leaf::Ident(_) | tt::Leaf::Literal(_) if has_sep => {
158 Err(ExpandError::InvalidRepeat)? 158 return Err(ExpandError::InvalidRepeat)
159 } 159 }
160 tt::Leaf::Ident(ident) => separator = Separator::Ident(ident.clone()), 160 tt::Leaf::Ident(ident) => separator = Separator::Ident(ident.clone()),
161 tt::Leaf::Literal(lit) => separator = Separator::Literal(lit.clone()), 161 tt::Leaf::Literal(lit) => separator = Separator::Literal(lit.clone()),
@@ -168,11 +168,11 @@ fn parse_repeat(src: &mut TtIter) -> Result<(Option<Separator>, RepeatKind), Exp
168 match &mut separator { 168 match &mut separator {
169 Separator::Puncts(puncts) => { 169 Separator::Puncts(puncts) => {
170 if puncts.len() == 3 { 170 if puncts.len() == 3 {
171 Err(ExpandError::InvalidRepeat)? 171 return Err(ExpandError::InvalidRepeat);
172 } 172 }
173 puncts.push(punct.clone()) 173 puncts.push(punct.clone())
174 } 174 }
175 _ => Err(ExpandError::InvalidRepeat)?, 175 _ => return Err(ExpandError::InvalidRepeat),
176 } 176 }
177 continue; 177 continue;
178 } 178 }