Skip to content

Commit

Permalink
Resolve while_let_on_iterator clippy lint
Browse files Browse the repository at this point in the history
    warning: this loop could be written as a `for` loop
        --> serde/src/private/de.rs:2905:9
         |
    2905 |         while let Some(item) = self.iter.next() {
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for item in self.iter.by_ref()`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator
         = note: `#[warn(clippy::while_let_on_iterator)]` on by default
  • Loading branch information
dtolnay committed May 10, 2023
1 parent 9441a29 commit b5a9eff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion serde/src/private/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2902,7 +2902,7 @@ where
where
T: DeserializeSeed<'de>,
{
while let Some(item) = self.iter.next() {
for item in self.iter.by_ref() {
if let Some((key, content)) = use_item(item, self.fields) {
self.pending_content = Some(content);
return seed.deserialize(ContentDeserializer::new(key)).map(Some);
Expand Down

0 comments on commit b5a9eff

Please sign in to comment.