Skip to content

Commit a79fb01

Browse files
committed
use bool.then
1 parent 81b7c41 commit a79fb01

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

compiler/parser/src/lexer.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,7 @@ where
438438
fn take_number(&mut self, radix: u32) -> Option<char> {
439439
let take_char = Lexer::<T>::is_digit_of_radix(self.window[0], radix);
440440

441-
if take_char {
442-
Some(self.next_char().unwrap())
443-
} else {
444-
None
445-
}
441+
take_char.then(|| self.next_char().unwrap())
446442
}
447443

448444
/// Test if a digit is of a certain radix.

0 commit comments

Comments
 (0)