From 3530cc3405ad39c17449706a1f3aa50a5ae93003 Mon Sep 17 00:00:00 2001 From: Ben-PH Date: Wed, 22 Jan 2025 14:50:43 +0100 Subject: [PATCH] derive `Default` for `State` in observables e.g. --- nexosim-util/examples/observables.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nexosim-util/examples/observables.rs b/nexosim-util/examples/observables.rs index 16e598c..c80f2b0 100644 --- a/nexosim-util/examples/observables.rs +++ b/nexosim-util/examples/observables.rs @@ -48,18 +48,14 @@ pub enum ModeId { } /// Processor state. +#[derive(Default)] pub enum State { + #[default] Off, Idle, Processing(AutoActionKey), } -impl Default for State { - fn default() -> Self { - State::Off - } -} - impl Observable for State { fn observe(&self) -> ModeId { match *self {