Selaa lähdekoodia

multiboot2: streamline code style

Philipp Schuster 8 kuukautta sitten
vanhempi
commit
a9d93eee6b

+ 2 - 2
multiboot2/src/boot_loader_name.rs

@@ -3,11 +3,11 @@
 use crate::tag::{StringError, TagHeader};
 use crate::{Tag, TagTrait, TagType, TagTypeId};
 use core::fmt::{Debug, Formatter};
-use core::mem::size_of;
+use core::mem;
 #[cfg(feature = "builder")]
 use {crate::builder::BoxedDst, alloc::vec::Vec};
 
-const METADATA_SIZE: usize = size_of::<TagTypeId>() + size_of::<u32>();
+const METADATA_SIZE: usize = mem::size_of::<TagTypeId>() + mem::size_of::<u32>();
 
 /// The bootloader name tag.
 #[derive(ptr_meta::Pointee, PartialEq, Eq, PartialOrd, Ord, Hash)]

+ 1 - 1
multiboot2/src/command_line.rs

@@ -8,7 +8,7 @@ use core::str;
 #[cfg(feature = "builder")]
 use {crate::builder::BoxedDst, alloc::vec::Vec};
 
-pub const METADATA_SIZE: usize = mem::size_of::<TagTypeId>() + mem::size_of::<u32>();
+const METADATA_SIZE: usize = mem::size_of::<TagTypeId>() + mem::size_of::<u32>();
 
 /// This tag contains the command line string.
 ///

+ 2 - 2
multiboot2/src/elf_sections.rs

@@ -4,10 +4,10 @@
 use crate::builder::BoxedDst;
 use crate::{Tag, TagTrait, TagType, TagTypeId};
 use core::fmt::{Debug, Formatter};
-use core::mem::size_of;
+use core::mem;
 use core::str::Utf8Error;
 
-const METADATA_SIZE: usize = size_of::<TagTypeId>() + 4 * size_of::<u32>();
+const METADATA_SIZE: usize = mem::size_of::<TagTypeId>() + 4 * mem::size_of::<u32>();
 
 /// This tag contains the section header table from an ELF binary.
 // The sections iterator is provided via the [`ElfSectionsTag::sections`]

+ 7 - 7
multiboot2/src/framebuffer.rs

@@ -3,7 +3,7 @@
 use crate::tag::TagHeader;
 use crate::{Tag, TagTrait, TagType, TagTypeId};
 use core::fmt::Debug;
-use core::mem::size_of;
+use core::mem;
 use core::slice;
 use derive_more::Display;
 #[cfg(feature = "builder")]
@@ -42,11 +42,11 @@ impl Reader {
     }
 }
 
-const METADATA_SIZE: usize = size_of::<TagTypeId>()
-    + 4 * size_of::<u32>()
-    + size_of::<u64>()
-    + size_of::<u16>()
-    + 2 * size_of::<u8>();
+const METADATA_SIZE: usize = mem::size_of::<TagTypeId>()
+    + 4 * mem::size_of::<u32>()
+    + mem::size_of::<u64>()
+    + mem::size_of::<u16>()
+    + 2 * mem::size_of::<u8>();
 
 /// The VBE Framebuffer information tag.
 #[derive(ptr_meta::Pointee, Eq)]
@@ -343,6 +343,6 @@ mod tests {
     // Compile time test
     #[test]
     fn test_size() {
-        assert_eq!(size_of::<FramebufferColor>(), 3)
+        assert_eq!(mem::size_of::<FramebufferColor>(), 3)
     }
 }

+ 2 - 2
multiboot2/src/module.rs

@@ -3,11 +3,11 @@
 use crate::tag::{StringError, TagHeader, TagIter};
 use crate::{Tag, TagTrait, TagType, TagTypeId};
 use core::fmt::{Debug, Formatter};
-use core::mem::size_of;
+use core::mem;
 #[cfg(feature = "builder")]
 use {crate::builder::BoxedDst, alloc::vec::Vec};
 
-const METADATA_SIZE: usize = size_of::<TagTypeId>() + 3 * size_of::<u32>();
+const METADATA_SIZE: usize = mem::size_of::<TagTypeId>() + 3 * mem::size_of::<u32>();
 
 /// The module tag can occur multiple times and specifies passed boot modules
 /// (blobs in memory). The tag itself doesn't include the blog, but references

+ 3 - 3
multiboot2/src/smbios.rs

@@ -5,10 +5,10 @@ use crate::builder::BoxedDst;
 use crate::tag::TagHeader;
 use crate::{Tag, TagTrait, TagType, TagTypeId};
 use core::fmt::Debug;
+use core::mem;
 
-const METADATA_SIZE: usize = core::mem::size_of::<TagTypeId>()
-    + core::mem::size_of::<u32>()
-    + core::mem::size_of::<u8>() * 8;
+const METADATA_SIZE: usize =
+    mem::size_of::<TagTypeId>() + mem::size_of::<u32>() + mem::size_of::<u8>() * 8;
 
 /// This tag contains a copy of SMBIOS tables as well as their version.
 #[derive(ptr_meta::Pointee, PartialEq, Eq, PartialOrd, Ord, Hash)]