Skip to content

Commit ddb81bd

Browse files
authored
Merge pull request #1144 from nicholasbishop/bishop-cleanup-macros-imports
Minor import/export cleanups
2 parents 0c533bd + 826e559 commit ddb81bd

File tree

19 files changed

+38
-41
lines changed

19 files changed

+38
-41
lines changed

uefi/src/data_types/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -138,23 +138,23 @@ pub trait Align {
138138
}
139139

140140
mod guid;
141-
pub use self::guid::{Guid, Identify};
141+
pub use guid::{Guid, Identify};
142142

143143
pub mod chars;
144-
pub use self::chars::{Char16, Char8};
144+
pub use chars::{Char16, Char8};
145145

146146
#[macro_use]
147147
mod opaque;
148148

149149
mod strs;
150-
pub use self::strs::{
150+
pub use strs::{
151151
CStr16, CStr8, EqStrUntilNul, FromSliceWithNulError, FromStrWithBufError, UnalignedCStr16Error,
152152
};
153153

154154
#[cfg(feature = "alloc")]
155155
mod owned_strs;
156156
#[cfg(feature = "alloc")]
157-
pub use self::owned_strs::{CString16, FromStrError};
157+
pub use owned_strs::{CString16, FromStrError};
158158

159159
mod unaligned_slice;
160160
pub use unaligned_slice::UnalignedSlice;

uefi/src/data_types/strs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,8 @@ where
620620
#[cfg(test)]
621621
mod tests {
622622
use super::*;
623+
use crate::{cstr16, cstr8};
623624
use alloc::string::String;
624-
use uefi_macros::{cstr16, cstr8};
625625

626626
// Tests if our CStr8 type can be constructed from a valid core::ffi::CStr
627627
#[test]

uefi/src/fs/dir_entry_iter.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//! Module for directory iteration. See [`UefiDirectoryIter`].
22
33
use super::*;
4-
use crate::{CStr16, Result};
4+
use crate::{cstr16, CStr16, Result};
55
use alloc::boxed::Box;
6-
use uefi_macros::cstr16;
76

87
/// Common skip dirs in UEFI/FAT-style file systems.
98
pub const COMMON_SKIP_DIRS: &[&CStr16] = &[cstr16!("."), cstr16!("..")];

uefi/src/fs/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
//! There is no automatic synchronization of the file system for concurrent
4848
//! accesses. This is in the responsibility of the user.
4949
//!
50-
//! [`cstr16!`]: uefi_macros::cstr16
50+
//! [`cstr16!`]: crate::cstr16
5151
5252
mod dir_entry_iter;
5353
mod file_system;

uefi/src/fs/path/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ pub use path::{Components, Path};
2121
pub use pathbuf::PathBuf;
2222

2323
use crate::data_types::chars::NUL_16;
24-
use crate::{CStr16, Char16};
24+
use crate::{cstr16, CStr16, Char16};
2525
pub(super) use validation::validate_path;
2626
pub use validation::PathError;
2727

2828
/// The default separator for paths.
2929
pub const SEPARATOR: Char16 = unsafe { Char16::from_u16_unchecked('\\' as u16) };
3030

3131
/// Stringified version of [`SEPARATOR`].
32-
pub const SEPARATOR_STR: &CStr16 = uefi_macros::cstr16!("\\");
32+
pub const SEPARATOR_STR: &CStr16 = cstr16!("\\");
3333

3434
/// Deny list of characters for path components. UEFI supports FAT-like file
3535
/// systems. According to <https://en.wikipedia.org/wiki/Comparison_of_file_systems>,

uefi/src/fs/path/path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ mod convenience_impls {
198198
#[cfg(test)]
199199
mod tests {
200200
use super::*;
201+
use crate::cstr16;
201202
use alloc::vec::Vec;
202-
use uefi_macros::cstr16;
203203

204204
#[test]
205205
fn from_cstr16() {

uefi/src/fs/path/pathbuf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ mod convenience_impls {
120120
#[cfg(test)]
121121
mod tests {
122122
use super::*;
123+
use crate::cstr16;
123124
use alloc::string::ToString;
124-
use uefi_macros::cstr16;
125125

126126
#[test]
127127
fn from_cstr16() {

uefi/src/fs/path/validation.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ pub fn validate_path<P: AsRef<Path>>(path: P) -> Result<(), PathError> {
6767
mod tests {
6868
use super::*;
6969
use crate::fs::PathBuf;
70-
use crate::CString16;
71-
use uefi_macros::cstr16;
70+
use crate::{cstr16, CString16};
7271

7372
#[test]
7473
fn test_validate_path() {

uefi/src/helpers/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn init(st: &mut SystemTable<Boot>) -> Result<()> {
9292

9393
#[cfg(feature = "global_allocator")]
9494
unsafe {
95-
uefi::allocator::init(st);
95+
crate::allocator::init(st);
9696
}
9797

9898
Ok(())
@@ -111,5 +111,5 @@ pub(crate) fn exit() {
111111
logger::disable();
112112

113113
#[cfg(feature = "global_allocator")]
114-
uefi::allocator::exit_boot_services();
114+
crate::allocator::exit_boot_services();
115115
}

uefi/src/helpers/panic_handler.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ fn panic_handler(info: &core::panic::PanicInfo) -> ! {
2929
} else {
3030
// If the system table is available, use UEFI's standard shutdown mechanism
3131
if let Some(st) = system_table_opt() {
32-
use uefi::table::runtime::ResetType;
32+
use crate::table::runtime::ResetType;
3333
st.runtime_services()
34-
.reset(ResetType::SHUTDOWN, uefi::Status::ABORTED, None);
34+
.reset(ResetType::SHUTDOWN, crate::Status::ABORTED, None);
3535
}
3636

3737
// If we don't have any shutdown mechanism handy, the best we can do is loop

uefi/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ extern crate uefi_raw;
106106
#[macro_use]
107107
pub mod data_types;
108108
#[cfg(feature = "alloc")]
109-
pub use self::data_types::CString16;
110-
pub use self::data_types::{CStr16, CStr8, Char16, Char8, Event, Guid, Handle, Identify};
109+
pub use data_types::CString16;
110+
pub use data_types::{CStr16, CStr8, Char16, Char8, Event, Guid, Handle, Identify};
111111
pub use uefi_macros::{cstr16, cstr8, entry};
112112
pub use uguid::guid;
113113

114114
mod result;
115-
pub use self::result::{Error, Result, ResultExt, Status, StatusExt};
115+
pub use result::{Error, Result, ResultExt, Status, StatusExt};
116116

117117
pub mod table;
118118

@@ -139,7 +139,7 @@ mod util;
139139
// Crates that create procedural macros can't unit test the macros they export.
140140
// Therefore, we do some tests here.
141141
mod macro_tests {
142-
use uefi_macros::{cstr16, cstr8};
142+
use crate::{cstr16, cstr8};
143143

144144
#[test]
145145
fn cstr8_macro_literal() {

uefi/src/prelude.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
//!
33
//! This includes the system table types, `Status` codes, etc.
44
5-
pub use crate::{Handle, ResultExt, Status, StatusExt};
5+
pub use crate::{cstr16, cstr8, entry, Handle, ResultExt, Status, StatusExt};
66

77
// Import the basic table types.
88
pub use crate::table::boot::BootServices;
99
pub use crate::table::runtime::RuntimeServices;
1010
pub use crate::table::{Boot, SystemTable};
11-
12-
// Import the macro for creating the custom entry point, as well as the cstr macros.
13-
pub use uefi_macros::{cstr16, cstr8, entry};

uefi/src/proto/console/text/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Text I/O.
22
33
mod input;
4-
pub use self::input::{Input, Key, ScanCode};
4+
pub use input::{Input, Key, ScanCode};
55

66
mod output;
7-
pub use self::output::{Color, Output, OutputMode};
7+
pub use output::{Color, Output, OutputMode};

uefi/src/proto/debug/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use crate::proto::unsafe_protocol;
1515
use crate::{Result, Status, StatusExt};
1616

1717
// re-export for ease of use
18-
pub use self::context::SystemContext;
19-
pub use self::exception::ExceptionType;
18+
pub use context::SystemContext;
19+
pub use exception::ExceptionType;
2020

2121
mod context;
2222
mod exception;

uefi/src/proto/media/file/mod.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@ use core::ffi::c_void;
1515
use core::fmt::Debug;
1616
use core::{mem, ptr};
1717
use uefi_raw::protocol::file_system::FileProtocolV1;
18+
1819
#[cfg(all(feature = "unstable", feature = "alloc"))]
1920
use {alloc::alloc::Global, core::alloc::Allocator};
21+
2022
#[cfg(feature = "alloc")]
21-
use {alloc::boxed::Box, uefi::mem::make_boxed};
23+
use {crate::mem::make_boxed, alloc::boxed::Box};
2224

23-
pub use self::dir::Directory;
24-
pub use self::info::{
25+
pub use dir::Directory;
26+
pub use info::{
2527
FileInfo, FileInfoCreationError, FileProtocolInfo, FileSystemInfo, FileSystemVolumeLabel,
2628
FromUefi,
2729
};
28-
pub use self::regular::RegularFile;
30+
pub use regular::RegularFile;
2931
pub use uefi_raw::protocol::file_system::FileAttribute;
3032

3133
/// Common interface to `FileHandle`, `RegularFile`, and `Directory`.

uefi/src/proto/network/snp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
1010
use super::{IpAddress, MacAddress};
1111
use crate::data_types::Event;
12+
use crate::proto::unsafe_protocol;
1213
use crate::{Result, Status, StatusExt};
1314
use bitflags::bitflags;
1415
use core::ffi::c_void;
1516
use core::ptr;
1617
use core::ptr::NonNull;
17-
use uefi_macros::unsafe_protocol;
1818

1919
/// The Simple Network Protocol
2020
#[derive(Debug)]

uefi/src/result/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use core::fmt::Debug;
44

55
/// The error type that we use, essentially a status code + optional additional data
66
mod error;
7-
pub use self::error::Error;
7+
pub use error::Error;
88

99
/// Definition of UEFI's standard status codes
1010
mod status;
11-
pub use self::status::{Status, StatusExt};
11+
pub use status::{Status, StatusExt};
1212

1313
/// Return type of most UEFI functions. Both success and error payloads are optional.
1414
///

uefi/src/table/boot.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ impl BootServices {
9595
/// Update the global image [`Handle`].
9696
///
9797
/// This is called automatically in the `main` entry point as part
98-
/// of [`uefi_macros::entry`]. It should not be called at any other
98+
/// of [`uefi::entry`]. It should not be called at any other
9999
/// point in time, unless the executable does not use
100-
/// [`uefi_macros::entry`], in which case it should be called once
100+
/// [`uefi::entry`], in which case it should be called once
101101
/// before calling other `BootServices` functions.
102102
///
103103
/// # Safety

uefi/src/table/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ pub trait Table {
88
}
99

1010
mod header;
11-
pub use self::header::Header;
11+
pub use header::Header;
1212

1313
mod system;
14-
pub use self::system::{Boot, Runtime, SystemTable};
14+
pub use system::{Boot, Runtime, SystemTable};
1515

1616
pub mod boot;
1717
pub mod runtime;

0 commit comments

Comments
 (0)