diff --git a/ableos/src/boot_conf.rs b/ableos/src/boot_conf.rs index f875eef9..e91cf25c 100644 --- a/ableos/src/boot_conf.rs +++ b/ableos/src/boot_conf.rs @@ -26,8 +26,7 @@ pub struct KernelConfig { impl KernelConfig { pub fn new() -> Self { - let p: KernelConfig = toml::from_str(include_str!("../assets/kernel.toml")).unwrap(); - p + toml::from_str(include_str!("../assets/kernel.toml")).unwrap() } pub fn log_level(&self) -> LevelFilter { @@ -43,6 +42,12 @@ impl KernelConfig { } } +impl Default for KernelConfig { + fn default() -> Self { + Self::new() + } +} + #[derive(Serialize, Debug, Deserialize)] pub struct LoggingConfig { pub enabled: bool, diff --git a/ableos/src/devices/mod.rs b/ableos/src/devices/mod.rs index 01aca596..42705408 100644 --- a/ableos/src/devices/mod.rs +++ b/ableos/src/devices/mod.rs @@ -38,5 +38,11 @@ impl DeviceTable { } } +impl Default for DeviceTable { + fn default() -> Self { + Self::new() + } +} + pub static DEVICE_TABLE: Lazy> = Lazy::new(|| spin::Mutex::new(DeviceTable::new())); diff --git a/ableos/src/experiments/info.rs b/ableos/src/experiments/info.rs index 35b99086..be9ede07 100644 --- a/ableos/src/experiments/info.rs +++ b/ableos/src/experiments/info.rs @@ -286,6 +286,12 @@ impl VersionInformation { }); } +impl Default for VersionInformation { + fn default() -> Self { + Self::new() + } +} + impl fmt::Debug for VersionInformation { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { dump!(self, f, "VersionInformation", { @@ -921,6 +927,12 @@ impl Master { delegate_flag!(time_stamp_counter, { invariant_tsc }); } + +impl Default for Master { + fn default() -> Self { + Self::new() + } +} /* cfg_if! { if #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] { diff --git a/ableos/src/experiments/mail.rs b/ableos/src/experiments/mail.rs index 6470643f..06134989 100644 --- a/ableos/src/experiments/mail.rs +++ b/ableos/src/experiments/mail.rs @@ -101,3 +101,9 @@ impl MailBoxes { ); } } + +impl Default for MailBoxes { + fn default() -> Self { + Self::new() + } +} diff --git a/ableos/src/experiments/y_compositor/compositor.rs b/ableos/src/experiments/y_compositor/compositor.rs index 2ea6da00..03fb0bea 100644 --- a/ableos/src/experiments/y_compositor/compositor.rs +++ b/ableos/src/experiments/y_compositor/compositor.rs @@ -1,7 +1,13 @@ -pub struct Compositor {} +pub struct Compositor; impl Compositor { pub fn new() -> Self { - Self {} + Self + } +} + +impl Default for Compositor { + fn default() -> Self { + Self::new() } } diff --git a/ableos/src/kernel_state.rs b/ableos/src/kernel_state.rs index be421b29..52ec3712 100644 --- a/ableos/src/kernel_state.rs +++ b/ableos/src/kernel_state.rs @@ -28,3 +28,9 @@ impl KernelInternalState { } } } + +impl Default for KernelInternalState { + fn default() -> Self { + Self::new() + } +}