Skip to content

Commit beb1f81

Browse files
committed
[assembler] Fix some clippy warnings.
1 parent 735cd62 commit beb1f81

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

assembler/src/asmlib/lexer.rs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl NumericLiteral {
5959

6060
pub(crate) fn append_digits_of_literal(&mut self, other: NumericLiteral) {
6161
assert!(!other.has_trailing_dot);
62-
self.digits.extend(other.digits.chars());
62+
self.digits.push_str(&other.digits);
6363
}
6464

6565
pub(crate) fn has_trailing_dot(&self) -> bool {
@@ -326,21 +326,15 @@ mod lexer_impl_new {
326326
fn next_named_glyph(&mut self) -> Option<Result<Elevated<&'static Glyph>, Unrecognised>> {
327327
let mut name: String = String::with_capacity(10);
328328
let mut got_anything = false;
329-
loop {
330-
match self.get_next_char() {
331-
Some(ch) => {
332-
got_anything = true;
333-
if ch == '@' {
334-
break;
335-
} else {
336-
name.push(ch);
337-
}
338-
}
339-
None => {
340-
break;
341-
}
329+
while let Some(ch) = self.get_next_char() {
330+
got_anything = true;
331+
if ch == '@' {
332+
break;
333+
} else {
334+
name.push(ch);
342335
}
343336
}
337+
344338
// If the input was @@, (that is, the glyph name is
345339
// zero-length) name is empty but got_anything is
346340
// (correctly) true.
@@ -355,7 +349,7 @@ mod lexer_impl_new {
355349
}
356350
}
357351

358-
impl<'a> Iterator for GlyphRecognizer<'a> {
352+
impl Iterator for GlyphRecognizer<'_> {
359353
type Item = Result<Elevated<&'static Glyph>, Unrecognised>;
360354

361355
fn next(&mut self) -> Option<Self::Item> {
@@ -671,7 +665,7 @@ mod lexer_impl_new {
671665
}
672666
Token::SuperscriptSymexSyllable(sym) => {
673667
let mut s: String = existing.digits;
674-
s.extend(sym.chars());
668+
s.push_str(&sym);
675669
TokenMergeResult::Merged(Token::SuperscriptSymexSyllable(s), merged_span)
676670
}
677671
other => TokenMergeResult::Failed {
@@ -724,7 +718,7 @@ mod lexer_impl_new {
724718
}
725719
Token::NormalSymexSyllable(sym) => {
726720
let mut s: String = existing.digits;
727-
s.extend(sym.chars());
721+
s.push_str(&sym);
728722
TokenMergeResult::Merged(Token::NormalSymexSyllable(s), merged_span)
729723
}
730724
other => TokenMergeResult::Failed {
@@ -764,7 +758,7 @@ mod lexer_impl_new {
764758
}
765759
Token::SubscriptSymexSyllable(sym) => {
766760
let mut s: String = existing.digits;
767-
s.extend(sym.chars());
761+
s.push_str(&sym);
768762
TokenMergeResult::Merged(Token::SubscriptSymexSyllable(s), merged_span)
769763
}
770764
other => TokenMergeResult::Failed {
@@ -1039,7 +1033,7 @@ mod lexer_impl_new {
10391033
}
10401034
}
10411035

1042-
impl<'a> Iterator for NewLexer<'a> {
1036+
impl Iterator for NewLexer<'_> {
10431037
type Item = Result<Token, Unrecognised>;
10441038

10451039
fn next(&mut self) -> Option<Result<Token, Unrecognised>> {
@@ -1058,7 +1052,7 @@ mod lexer_impl_new {
10581052
}
10591053
}
10601054

1061-
impl<'a> Iterator for SpannedIter<'a> {
1055+
impl Iterator for SpannedIter<'_> {
10621056
type Item = (Result<Token, Unrecognised>, Span);
10631057

10641058
fn next(&mut self) -> Option<Self::Item> {

0 commit comments

Comments
 (0)