From b86d42e48ca58ff4e0e7ab2aafb88b0ac499badf Mon Sep 17 00:00:00 2001 From: Erin Date: Mon, 11 Apr 2022 23:07:01 +0200 Subject: [PATCH] Obeyed clippy, our paperclip overlord (mostly) --- ableos/src/boot_conf.rs | 9 +++++++-- ableos/src/devices/mod.rs | 6 ++++++ ableos/src/experiments/info.rs | 12 ++++++++++++ ableos/src/experiments/mail.rs | 6 ++++++ ableos/src/experiments/y_compositor/compositor.rs | 10 ++++++++-- ableos/src/kernel_state.rs | 6 ++++++ 6 files changed, 45 insertions(+), 4 deletions(-) diff --git a/ableos/src/boot_conf.rs b/ableos/src/boot_conf.rs index f875eef..e91cf25 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 01aca59..4270540 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 35b9908..be9ede0 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 6470643..0613498 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 2ea6da0..03fb0be 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 be421b2..52ec371 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() + } +}