From bf2d49f8b4f35c6e8b3790d0ef2152e11b60bc83 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Sun, 11 Dec 2022 17:08:36 +0100 Subject: [PATCH] Reuse `ValidationFailed` to simplify struct field --- crates/fj-kernel/src/services/validation.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/crates/fj-kernel/src/services/validation.rs b/crates/fj-kernel/src/services/validation.rs index 63da9bf25..c3f8f9d4d 100644 --- a/crates/fj-kernel/src/services/validation.rs +++ b/crates/fj-kernel/src/services/validation.rs @@ -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, ValidationError)>, -); +pub struct Validation(pub BTreeMap); impl Drop for Validation { fn drop(&mut self) { @@ -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() { @@ -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()); } }