Skip to content

Commit 42dbc72

Browse files
committed
Adjust to_attr_token_stream.
It uses `once` chained with `(0..self.num_calls).map(...)` followed by `.take(self.num_calls`. I found this hard to read. It's simpler to just use `repeat_with`.
1 parent 58e967a commit 42dbc72

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_parse/src/parser/attr_wrapper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl ToAttrTokenStream for LazyAttrTokenStreamImpl {
106106
let mut cursor_snapshot = self.cursor_snapshot.clone();
107107
let tokens =
108108
std::iter::once((FlatToken::Token(self.start_token.0.clone()), self.start_token.1))
109-
.chain((0..self.num_calls).map(|_| {
109+
.chain(std::iter::repeat_with(|| {
110110
let token = cursor_snapshot.next();
111111
(FlatToken::Token(token.0), token.1)
112112
}))

0 commit comments

Comments
 (0)