Skip to content

Commit

Permalink
multiboot2: streamline code style
Browse files Browse the repository at this point in the history
  • Loading branch information
phip1611 committed Aug 14, 2024
1 parent ad0da17 commit 089431b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions multiboot2/src/boot_loader_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion multiboot2/src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
4 changes: 2 additions & 2 deletions multiboot2/src/elf_sections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`]
Expand Down
12 changes: 6 additions & 6 deletions multiboot2/src/framebuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions multiboot2/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions multiboot2/src/smbios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 089431b

Please sign in to comment.