Skip to content

Commit 9c5df8f

Browse files
committed
Remove extraneous check from take_until_newline_or_eof
1 parent 9f35e11 commit 9c5df8f

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/strnom.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,16 +262,12 @@ macro_rules! option {
262262
}
263263

264264
macro_rules! take_until_newline_or_eof {
265-
($i:expr,) => {{
266-
if $i.len() == 0 {
267-
Ok(($i, ""))
268-
} else {
269-
match $i.find('\n') {
270-
Some(i) => Ok(($i.advance(i), &$i.rest[..i])),
271-
None => Ok(($i.advance($i.len()), &$i.rest[..$i.len()])),
272-
}
265+
($i:expr,) => {
266+
match $i.find('\n') {
267+
Some(i) => Ok(($i.advance(i), &$i.rest[..i])),
268+
None => Ok(($i.advance($i.len()), &$i.rest[..$i.len()])),
273269
}
274-
}};
270+
};
275271
}
276272

277273
macro_rules! pair {

0 commit comments

Comments
 (0)