Skip to content

Commit

Permalink
Reuse ValidationFailed to simplify struct field
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Dec 11, 2022
1 parent 3a7215b commit bf2d49f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions crates/fj-kernel/src/services/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ use super::{objects::ObjectToInsert, State};

/// Errors that occurred while validating the objects inserted into the stores
#[derive(Default)]
pub struct Validation(
pub BTreeMap<ObjectId, (Object<BehindHandle>, ValidationError)>,
);
pub struct Validation(pub BTreeMap<ObjectId, ValidationFailed>);

impl Drop for Validation {
fn drop(&mut self) {
Expand All @@ -23,8 +21,8 @@ impl Drop for Validation {
errors:"
);

for (_, err) in self.0.values() {
println!("{err}");
for event in self.0.values() {
println!("{}", event.err);
}

if !thread::panicking() {
Expand All @@ -48,10 +46,7 @@ impl State for Validation {
}

fn evolve(&mut self, event: &Self::Event) {
self.0.insert(
event.object.id(),
(event.object.clone(), event.err.clone()),
);
self.0.insert(event.object.id(), event.clone());
}
}

Expand Down

0 comments on commit bf2d49f

Please sign in to comment.