Skip to content

Commit 058b2cb

Browse files
committed
Improvements to while_let_on_iterator
* Suggest `&mut iter` when the iterator is used after the loop. * Suggest `&mut iter` when the iterator is a field in a struct. * Don't lint when the iterator is a field in a struct, and the struct is used in the loop. * Lint when the loop is nested in another loop, but suggest `&mut iter` unless the iterator is from a local declared inside the loop.
1 parent b80903b commit 058b2cb

File tree

7 files changed

+704
-198
lines changed

7 files changed

+704
-198
lines changed

clippy_lints/src/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ pub fn strip_doc_comment_decoration(doc: &str, comment_kind: CommentKind, span:
383383
let mut no_stars = String::with_capacity(doc.len());
384384
for line in doc.lines() {
385385
let mut chars = line.chars();
386-
while let Some(c) = chars.next() {
386+
for c in &mut chars {
387387
if c.is_whitespace() {
388388
no_stars.push(c);
389389
} else {

0 commit comments

Comments
 (0)