Reduce usage of Default::default()

This commit is contained in:
Stephen Chung
2021-09-11 19:40:40 +08:00
parent 5d3a22ab6f
commit 6510b617fe
14 changed files with 59 additions and 45 deletions

View File

@@ -1421,7 +1421,7 @@ fn get_next_token_inner(
// digit ...
('0'..='9', _) => {
let mut result: smallvec::SmallVec<[char; 16]> = Default::default();
let mut result = smallvec::SmallVec::<[char; 16]>::new();
let mut radix_base: Option<u32> = None;
let mut valid: fn(char) -> bool = is_numeric_digit;
result.push(c);
@@ -1951,7 +1951,7 @@ fn get_identifier(
start_pos: Position,
first_char: char,
) -> Option<(Token, Position)> {
let mut result: smallvec::SmallVec<[char; 8]> = Default::default();
let mut result = smallvec::SmallVec::<[char; 8]>::new();
result.push(first_char);
while let Some(next_char) = stream.peek_next() {