From b5a9eff32e041e531ff2c4a0764be076c679de54 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 10 May 2023 00:23:31 -0700 Subject: [PATCH] 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 --- serde/src/private/de.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serde/src/private/de.rs b/serde/src/private/de.rs index 35fb6a0a..8aab9d1d 100644 --- a/serde/src/private/de.rs +++ b/serde/src/private/de.rs @@ -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);