Skip to content

Commit 08d7d1f

Browse files
committed
uefi: lib.rs cleanup
Streamline the order of different statements. 1. extern crates 2. public modules 3. private modules 4. public uses 5. private use From my year-long experience, it is usually a better structure to group all `use` and all `mod` statements in a file. However, it is a matter of taste if `mod` or `use` comes first.
1 parent f0f14a6 commit 08d7d1f

File tree

1 file changed

+18
-30
lines changed

1 file changed

+18
-30
lines changed

uefi/src/lib.rs

+18-30
Original file line numberDiff line numberDiff line change
@@ -95,50 +95,38 @@
9595

9696
#[cfg(feature = "alloc")]
9797
extern crate alloc;
98-
9998
// allow referring to self as ::uefi for macros to work universally (from this crate and from others)
10099
// see https://github.com/rust-lang/rust/issues/54647
101100
extern crate self as uefi;
102-
103-
/// Re-export ucs2_cstr so that it can be used in the implementation of the
104-
/// cstr16 macro. It is hidden since it's not intended to be used directly.
105-
#[doc(hidden)]
106-
pub use ucs2::ucs2_cstr;
107-
108101
#[macro_use]
109102
extern crate uefi_raw;
110103

111104
#[macro_use]
112105
pub mod data_types;
106+
pub mod allocator;
113107
#[cfg(feature = "alloc")]
114-
pub use data_types::CString16;
115-
pub use data_types::{CStr16, CStr8, Char16, Char8, Event, Guid, Handle, Identify};
116-
pub use uefi_macros::entry;
117-
pub use uguid::guid;
118-
119-
mod result;
120-
pub use result::{Error, Result, ResultExt, Status, StatusExt};
121-
108+
pub mod fs;
109+
pub mod helpers;
110+
pub mod mem;
111+
pub mod prelude;
112+
pub mod proto;
122113
pub mod runtime;
123114
pub mod system;
124115
pub mod table;
125116

126-
pub mod proto;
127-
128-
pub mod prelude;
129-
130-
pub mod allocator;
131-
132-
#[cfg(feature = "alloc")]
133-
pub mod fs;
134-
135-
// As long as this is behind "alloc", we can simplify cfg-feature attributes in this module.
136-
#[cfg(feature = "alloc")]
137-
pub(crate) mod mem;
138-
139117
pub(crate) mod polyfill;
140118

141-
pub mod helpers;
142-
143119
mod macros;
120+
mod result;
144121
mod util;
122+
123+
#[cfg(feature = "alloc")]
124+
pub use data_types::CString16;
125+
pub use data_types::{CStr16, CStr8, Char16, Char8, Event, Guid, Handle, Identify};
126+
pub use result::{Error, Result, ResultExt, Status, StatusExt};
127+
/// Re-export ucs2_cstr so that it can be used in the implementation of the
128+
/// cstr16 macro. It is hidden since it's not intended to be used directly.
129+
#[doc(hidden)]
130+
pub use ucs2::ucs2_cstr;
131+
pub use uefi_macros::entry;
132+
pub use uguid::guid;

0 commit comments

Comments
 (0)