File tree 1 file changed +2
-13
lines changed
1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,6 @@ impl<'a> Parser<'a> {
44
44
Parser { state : input. as_bytes ( ) }
45
45
}
46
46
47
- fn is_eof ( & self ) -> bool {
48
- self . state . is_empty ( )
49
- }
50
-
51
47
/// Run a parser, and restore the pre-parse state if it fails
52
48
fn read_atomically < T , F > ( & mut self , inner : F ) -> Option < T >
53
49
where
@@ -63,19 +59,12 @@ impl<'a> Parser<'a> {
63
59
64
60
/// Run a parser, but fail if the entire input wasn't consumed.
65
61
/// Doesn't run atomically.
66
- fn read_till_eof < T , F > ( & mut self , inner : F ) -> Option < T >
67
- where
68
- F : FnOnce ( & mut Parser < ' _ > ) -> Option < T > ,
69
- {
70
- inner ( self ) . filter ( |_| self . is_eof ( ) )
71
- }
72
-
73
- /// Same as read_till_eof, but returns a Result<AddrParseError> on failure
74
62
fn parse_with < T , F > ( & mut self , inner : F ) -> Result < T , AddrParseError >
75
63
where
76
64
F : FnOnce ( & mut Parser < ' _ > ) -> Option < T > ,
77
65
{
78
- self . read_till_eof ( inner) . ok_or ( AddrParseError ( ( ) ) )
66
+ let result = inner ( self ) ;
67
+ if self . state . is_empty ( ) { result } else { None } . ok_or ( AddrParseError ( ( ) ) )
79
68
}
80
69
81
70
/// Read the next character from the input
You can’t perform that action at this time.
0 commit comments