Skip to content

Commit 930baee

Browse files
committed
refactor(gctx): prefer let-else
1 parent 96455a1 commit 930baee

File tree

1 file changed

+19
-20
lines changed
  • src/cargo/util/context

1 file changed

+19
-20
lines changed

src/cargo/util/context/de.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -461,26 +461,25 @@ impl<'de, 'gctx> de::SeqAccess<'de> for ConfigSeqAccess<'gctx> {
461461
where
462462
T: de::DeserializeSeed<'de>,
463463
{
464-
match self.list_iter.next() {
465-
Some((i, cv)) => {
466-
let mut key_path = ArrayItemKeyPath::new(self.de.key.clone());
467-
let definition = Some(cv.definition().clone());
468-
let de = ArrayItemDeserializer {
469-
cv,
470-
key_path: &mut key_path,
471-
};
472-
seed.deserialize(de)
473-
.map_err(|e| {
474-
// This along with ArrayItemKeyPath provide a better error context of the
475-
// ConfigValue definition + the key path within an array item that native
476-
// TOML key path can't express. For example, `foo.bar[3].baz`.
477-
key_path.push_index(i);
478-
e.with_array_item_key_context(&key_path, definition)
479-
})
480-
.map(Some)
481-
}
482-
None => Ok(None),
483-
}
464+
let Some((i, cv)) = self.list_iter.next() else {
465+
return Ok(None);
466+
};
467+
468+
let mut key_path = ArrayItemKeyPath::new(self.de.key.clone());
469+
let definition = Some(cv.definition().clone());
470+
let de = ArrayItemDeserializer {
471+
cv,
472+
key_path: &mut key_path,
473+
};
474+
seed.deserialize(de)
475+
.map_err(|e| {
476+
// This along with ArrayItemKeyPath provide a better error context of the
477+
// ConfigValue definition + the key path within an array item that native
478+
// TOML key path can't express. For example, `foo.bar[3].baz`.
479+
key_path.push_index(i);
480+
e.with_array_item_key_context(&key_path, definition)
481+
})
482+
.map(Some)
484483
}
485484
}
486485

0 commit comments

Comments
 (0)