Resolve while_let_on_iterator clippy lint

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
This commit is contained in:
David Tolnay 2023-05-10 00:23:31 -07:00
parent 9441a29663
commit b5a9eff32e
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -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);