schema: fixup empty error list handling

Some(<empty list of errors>) does not actually signal an error...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2023-03-06 16:02:21 +01:00 committed by Thomas Lamprecht
parent aa10025366
commit c702638bd8

View File

@ -37,7 +37,8 @@ impl SchemaGuard {
/// If this is the "final" guard, take out the errors:
fn errors(self) -> Option<Vec<(String, anyhow::Error)>> {
if self.0.is_none() {
Some(ERRORS.with(|e| mem::take(&mut *e.borrow_mut())))
let errors = ERRORS.with(|e| mem::take(&mut *e.borrow_mut()));
(!errors.is_empty()).then_some(errors)
} else {
None
}