Skip to content

Commit f29b4e3

Browse files
committed
Iterate directly rather than collecting
1 parent f45b5db commit f29b4e3

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

clippy_lints/src/doc/broken_link.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,12 @@ impl BrokenLinkReporter {
6868
}
6969

7070
fn scan_line(&mut self, cx: &LateContext<'_>, line: &str, attr_span: Span) {
71-
// Note that we specifically need the char _byte_ indices here, not the positional indexes
72-
// within the char array to deal with multi-byte characters properly. `char_indices` does
73-
// exactly that. It provides an iterator over tuples of the form `(byte position, char)`.
74-
let char_indices: Vec<_> = line.char_indices().collect();
75-
7671
let reading_link_url_new_line = matches!(
7772
self.state,
7873
Some(State::ProcessingLinkUrl(UrlState::FilledEntireSingleLine))
7974
);
8075

81-
for (pos, c) in char_indices {
76+
for (pos, c) in line.char_indices() {
8277
if pos == 0 && c.is_whitespace() {
8378
// ignore prefix whitespace on comments
8479
continue;

0 commit comments

Comments
 (0)