From 95a9a1a78829abfe255d56a42204cb7a378b2b37 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Tue, 20 Jun 2023 16:40:50 +0200 Subject: [PATCH] workspace: use workspace dependencies --- Cargo.lock | 1 + Cargo.toml | 4 ++++ multiboot2-header/Cargo.toml | 6 ++++++ multiboot2-header/src/header.rs | 10 ++-------- multiboot2/Cargo.toml | 7 ++++--- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3838d459..0c64b93f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,6 +40,7 @@ dependencies = [ name = "multiboot2-header" version = "0.3.0" dependencies = [ + "derive_more", "multiboot2", ] diff --git a/Cargo.toml b/Cargo.toml index 79c9ee88..b88c4703 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,10 @@ members = [ "multiboot2-header", ] +[workspace.dependencies] +bitflags = "2" +derive_more = { version = "0.99", default-features = false, features = ["display"] } +log = { version = "0.4", default-features = false } # This way, the "multiboot2" dependency in the multiboot2-header crate can be # referenced by version, while still the repository version is used diff --git a/multiboot2-header/Cargo.toml b/multiboot2-header/Cargo.toml index 1080eaba..70d2927d 100644 --- a/multiboot2-header/Cargo.toml +++ b/multiboot2-header/Cargo.toml @@ -40,5 +40,11 @@ builder = ["alloc"] unstable = [] [dependencies] +# Not yet used. +# bitflags.workspace = true +derive_more.workspace = true +# Not yet used. +# log.workspace = true + # used for MBI tags multiboot2 = "0.16.0" diff --git a/multiboot2-header/src/header.rs b/multiboot2-header/src/header.rs index 4270d112..9c3d83af 100644 --- a/multiboot2-header/src/header.rs +++ b/multiboot2-header/src/header.rs @@ -5,7 +5,7 @@ use crate::{ RelocatableHeaderTag, }; use core::convert::TryInto; -use core::fmt::{Debug, Display, Formatter}; +use core::fmt::{Debug, Formatter}; use core::mem::size_of; /// Magic value for a [`Multiboot2Header`], as defined in spec. @@ -200,7 +200,7 @@ impl<'a> Debug for Multiboot2Header<'a> { /// Errors that can occur when parsing a header from a slice. /// See [`Multiboot2Header::find_header`]. -#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Copy, Clone, Debug, derive_more::Display, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum LoadError { /// The checksum does not match the data. ChecksumMismatch, @@ -212,12 +212,6 @@ pub enum LoadError { TooSmall, } -impl Display for LoadError { - fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { - write!(f, "{:?}", self) - } -} - #[cfg(feature = "unstable")] impl core::error::Error for LoadError {} diff --git a/multiboot2/Cargo.toml b/multiboot2/Cargo.toml index 0078e282..24e41a56 100644 --- a/multiboot2/Cargo.toml +++ b/multiboot2/Cargo.toml @@ -41,8 +41,9 @@ builder = ["alloc"] unstable = [] [dependencies] -bitflags = "2" -derive_more = { version = "0.99", default-features = false, features = ["display"] } -log = { version = "0.4", default-features = false } +bitflags.workspace = true +derive_more.workspace = true +log.workspace = true + uefi-raw = { version = "0.2.0", default-features = false } ptr_meta = { version = "0.2.0", default-features = false }