Skip to content

Commit 91755fe

Browse files
committed
Use if let instead of match
(Review in whitespace changes ignored mode)
1 parent 8d42476 commit 91755fe

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/reader/buffered_reader.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,19 @@ macro_rules! impl_buffered_source {
112112
}
113113
};
114114

115-
match parser.feed(available) {
116-
Some(i) => {
117-
buf.extend_from_slice(&available[..i]);
115+
if let Some(i) = parser.feed(available) {
116+
buf.extend_from_slice(&available[..i]);
118117

119-
// +1 for `>` which we do not include
120-
self $(.$reader)? .consume(i + 1);
121-
read += i + 1;
118+
// +1 for `>` which we do not include
119+
self $(.$reader)? .consume(i + 1);
120+
read += i + 1;
122121

123-
*position += read;
124-
return Ok(&buf[start..]);
125-
}
126-
None => {
127-
buf.extend_from_slice(available);
128-
available.len()
129-
}
122+
*position += read;
123+
return Ok(&buf[start..]);
130124
}
125+
126+
buf.extend_from_slice(available);
127+
available.len()
131128
};
132129
self $(.$reader)? .consume(used);
133130
read += used;

0 commit comments

Comments
 (0)