Skip to content

Commit 361088e

Browse files
committed
Simplify Err(LexError)=>Err(LexError) arm in parsing literal
1 parent 51608bb commit 361088e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/parse.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,9 @@ fn ident_not_raw(input: Cursor) -> PResult<&str> {
287287
}
288288

289289
fn literal(input: Cursor) -> PResult<Literal> {
290-
match literal_nocapture(input) {
291-
Ok(a) => {
292-
let end = input.len() - a.len();
293-
Ok((a, Literal::_new(input.rest[..end].to_string())))
294-
}
295-
Err(LexError) => Err(LexError),
296-
}
290+
let rest = literal_nocapture(input)?;
291+
let end = input.len() - rest.len();
292+
Ok((rest, Literal::_new(input.rest[..end].to_string())))
297293
}
298294

299295
fn literal_nocapture(input: Cursor) -> Result<Cursor, LexError> {

0 commit comments

Comments
 (0)