Skip to content

Commit

Permalink
add back else case
Browse files Browse the repository at this point in the history
  • Loading branch information
pvichivanives committed Dec 19, 2024
1 parent 2799c01 commit d0a500d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 2 additions & 3 deletions validator/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,9 @@ impl ValidationErrors {
fn add_nested(&mut self, field: &'static str, errors: ValidationErrorsKind) {
if let Vacant(entry) = self.0.entry(field) {
entry.insert(errors);
} else {
panic!("Attempt to replace non-empty ValidationErrors entry");
}
// Else case here is simply do nothing. Pretty sure this is caught earlier to not run but since
// If we get here, just not adding it does the same thing (although waste extra compute)
// probably better to just ignore here.
}

#[must_use]
Expand Down
1 change: 0 additions & 1 deletion validator_derive_tests/tests/nested.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use serde::Serialize;
use std::{
borrow::Cow,
cmp::Ordering,
collections::{HashMap, HashSet},
};
use validator::{
Expand Down

0 comments on commit d0a500d

Please sign in to comment.