Skip to content

Commit e52d3ca

Browse files
committed
multiboot2: optimize imports
1 parent 17b53b1 commit e52d3ca

File tree

7 files changed

+34
-29
lines changed

7 files changed

+34
-29
lines changed

multiboot2/src/boot_loader_name.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use crate::{Tag, TagTrait, TagType, TagTypeId};
1+
use crate::{Tag, TagTrait, TagTypeId};
22
use core::fmt::{Debug, Formatter};
33
use core::mem::size_of;
44
use core::str::Utf8Error;
55

66
#[cfg(feature = "builder")]
77
use {
8-
crate::builder::boxed_dst_tag, crate::builder::traits::StructAsBytes, alloc::boxed::Box,
9-
alloc::vec::Vec,
8+
crate::builder::boxed_dst_tag, crate::builder::traits::StructAsBytes, crate::TagType,
9+
alloc::boxed::Box, alloc::vec::Vec,
1010
};
1111

1212
const METADATA_SIZE: usize = size_of::<TagTypeId>() + size_of::<u32>();

multiboot2/src/command_line.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
//! Module for [CommandLineTag].
22
3-
use crate::{Tag, TagTrait, TagType, TagTypeId};
3+
use crate::{Tag, TagTrait, TagTypeId};
44

5-
use core::convert::TryInto;
65
use core::fmt::{Debug, Formatter};
76
use core::mem;
87
use core::str;
98

109
#[cfg(feature = "builder")]
1110
use {
12-
crate::builder::boxed_dst_tag, crate::builder::traits::StructAsBytes, alloc::boxed::Box,
13-
alloc::vec::Vec,
11+
crate::builder::boxed_dst_tag, crate::builder::traits::StructAsBytes, crate::TagType,
12+
alloc::boxed::Box, alloc::vec::Vec, core::convert::TryInto,
1413
};
1514

1615
pub(crate) const METADATA_SIZE: usize = mem::size_of::<TagTypeId>() + mem::size_of::<u32>();

multiboot2/src/elf_sections.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
use crate::{Tag, TagTrait, TagType, TagTypeId};
1+
use crate::{Tag, TagTrait, TagTypeId};
22

33
use core::fmt::{Debug, Formatter};
44
use core::mem::size_of;
55
use core::str::Utf8Error;
66

77
#[cfg(feature = "builder")]
8-
use {crate::builder::boxed_dst_tag, crate::builder::traits::StructAsBytes, alloc::boxed::Box};
8+
use {
9+
crate::builder::boxed_dst_tag, crate::builder::traits::StructAsBytes, crate::TagType,
10+
alloc::boxed::Box,
11+
};
912

1013
const METADATA_SIZE: usize = size_of::<TagTypeId>() + 4 * size_of::<u32>();
1114

multiboot2/src/framebuffer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{Reader, Tag, TagTrait, TagType, TagTypeId};
1+
use crate::{Reader, Tag, TagTrait, TagTypeId};
22

33
use core::fmt::Debug;
44
use core::mem::size_of;
@@ -7,8 +7,8 @@ use derive_more::Display;
77

88
#[cfg(feature = "builder")]
99
use {
10-
crate::builder::boxed_dst_tag, crate::builder::traits::StructAsBytes, alloc::boxed::Box,
11-
alloc::vec::Vec,
10+
crate::builder::boxed_dst_tag, crate::builder::traits::StructAsBytes, crate::TagType,
11+
alloc::boxed::Box, alloc::vec::Vec,
1212
};
1313

1414
const METADATA_SIZE: usize = size_of::<TagTypeId>()
@@ -205,7 +205,7 @@ impl TryFrom<u8> for FramebufferTypeId {
205205
0 => Ok(Self::Indexed),
206206
1 => Ok(Self::RGB),
207207
2 => Ok(Self::Text),
208-
val => Err(UnknownFramebufferType(val))
208+
val => Err(UnknownFramebufferType(val)),
209209
}
210210
}
211211
}

multiboot2/src/image_load_addr.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use core::convert::TryInto;
2-
use core::mem::size_of;
3-
1+
use crate::tag_type::TagTypeId;
42
#[cfg(feature = "builder")]
5-
use crate::builder::traits::StructAsBytes;
6-
use crate::tag_type::{TagType, TagTypeId};
3+
use {
4+
crate::builder::traits::StructAsBytes, crate::TagType, core::convert::TryInto,
5+
core::mem::size_of,
6+
};
77

88
/// If the image has relocatable header tag, this tag contains the image's
99
/// base physical address.

multiboot2/src/rsdp.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@
88
//!
99
//! Even though the bootloader should give the address of the real RSDP/XSDT, the checksum and
1010
//! signature should be manually verified.
11-
#[cfg(feature = "builder")]
12-
use crate::builder::traits::StructAsBytes;
13-
use crate::tag_type::{TagType, TagTypeId};
11+
//!
1412

15-
use core::convert::TryInto;
16-
use core::mem::size_of;
13+
use crate::tag_type::TagTypeId;
1714
use core::slice;
1815
use core::str;
1916
use core::str::Utf8Error;
17+
#[cfg(feature = "builder")]
18+
use {
19+
crate::builder::traits::StructAsBytes, crate::TagType, core::convert::TryInto,
20+
core::mem::size_of,
21+
};
2022

2123
const RSDPV1_LENGTH: usize = 20;
2224

@@ -105,7 +107,8 @@ pub struct RsdpV2Tag {
105107
revision: u8,
106108
rsdt_address: u32,
107109
length: u32,
108-
xsdt_address: u64, // This is the PHYSICAL address of the XSDT
110+
xsdt_address: u64,
111+
// This is the PHYSICAL address of the XSDT
109112
ext_checksum: u8,
110113
_reserved: [u8; 3],
111114
}

multiboot2/src/smbios.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use crate::{Tag, TagTrait, TagType, TagTypeId};
2-
3-
use core::convert::TryInto;
1+
use crate::{Tag, TagTrait, TagTypeId};
42
use core::fmt::Debug;
5-
63
#[cfg(feature = "builder")]
7-
use {crate::builder::boxed_dst_tag, crate::builder::traits::StructAsBytes, alloc::boxed::Box};
4+
use {
5+
crate::builder::boxed_dst_tag, crate::builder::traits::StructAsBytes, crate::TagType,
6+
alloc::boxed::Box, core::convert::TryInto,
7+
};
88

99
const METADATA_SIZE: usize = core::mem::size_of::<TagTypeId>()
1010
+ core::mem::size_of::<u32>()

0 commit comments

Comments
 (0)