Skip to content

Commit d54512e

Browse files
Format use consistently
Most of the project uses the style of only merging imports from the same module. Normally this isn't handled by `cargo fmt`, so there are some inconsistencies. There's an unstable option [1] to rustfmt to make imports consistent, so as a one-time operation apply that to all source files: ``` cargo fmt --all -- --config imports_granularity=Module ``` [1]: https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#module
1 parent c654a5d commit d54512e

File tree

17 files changed

+44
-56
lines changed

17 files changed

+44
-56
lines changed

uefi-macros/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ use proc_macro::TokenStream;
66

77
use proc_macro2::{TokenStream as TokenStream2, TokenTree};
88
use quote::{quote, quote_spanned, ToTokens, TokenStreamExt};
9+
use syn::spanned::Spanned;
910
use syn::{
10-
parse_macro_input, parse_quote, spanned::Spanned, Error, Fields, FnArg, Ident, ItemFn,
11-
ItemStruct, LitStr, Pat, Visibility,
11+
parse_macro_input, parse_quote, Error, Fields, FnArg, Ident, ItemFn, ItemStruct, LitStr, Pat,
12+
Visibility,
1213
};
1314

1415
macro_rules! err {

uefi-test-runner/src/proto/device_path.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use uefi::prelude::*;
2-
use uefi::proto::device_path::{text::*, DevicePath};
2+
use uefi::proto::device_path::text::*;
3+
use uefi::proto::device_path::DevicePath;
34
use uefi::proto::loaded_image::LoadedImage;
45
use uefi::table::boot::BootServices;
56

uefi-test-runner/src/proto/network/pxe.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
use uefi::{
2-
prelude::BootServices,
3-
proto::network::{
4-
pxe::{BaseCode, DhcpV4Packet, IpFilter, IpFilters, UdpOpFlags},
5-
IpAddress,
6-
},
7-
CStr8,
8-
};
1+
use uefi::prelude::BootServices;
2+
use uefi::proto::network::pxe::{BaseCode, DhcpV4Packet, IpFilter, IpFilters, UdpOpFlags};
3+
use uefi::proto::network::IpAddress;
4+
use uefi::CStr8;
95

106
pub fn test(bt: &BootServices) {
117
// Skip the test if the `pxe` feature is not enabled.

uefi-test-runner/src/runtime/vars.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use log::info;
2-
use uefi::guid;
32
use uefi::prelude::*;
43
use uefi::table::runtime::{VariableAttributes, VariableVendor};
5-
use uefi::Status;
4+
use uefi::{guid, Status};
65

76
fn test_variables(rt: &RuntimeServices) {
87
let name = cstr16!("UefiRsTestVar");

uefi/src/data_types/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
//!
33
//! This module defines the basic data types that are used throughout uefi-rs
44
5-
use core::{ffi::c_void, ptr::NonNull};
5+
use core::ffi::c_void;
6+
use core::ptr::NonNull;
67

78
/// Opaque handle to an UEFI entity (protocol, image...), guaranteed to be non-null.
89
///
@@ -121,8 +122,7 @@ pub type PhysicalAddress = u64;
121122
pub type VirtualAddress = u64;
122123

123124
mod guid;
124-
pub use self::guid::Guid;
125-
pub use self::guid::Identify;
125+
pub use self::guid::{Guid, Identify};
126126

127127
pub mod chars;
128128
pub use self::chars::{Char16, Char8};

uefi/src/data_types/owned_strs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use crate::data_types::UnalignedSlice;
55
use crate::polyfill::vec_into_raw_parts;
66
use alloc::borrow::{Borrow, ToOwned};
77
use alloc::vec::Vec;
8-
use core::fmt;
9-
use core::ops;
8+
use core::{fmt, ops};
109

1110
/// Error returned by [`CString16::try_from::<&str>`].
1211
#[derive(Clone, Copy, Debug, Eq, PartialEq)]

uefi/src/data_types/strs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ use super::chars::{Char16, Char8, NUL_16, NUL_8};
22
use super::UnalignedSlice;
33
use crate::polyfill::maybe_uninit_slice_assume_init_ref;
44
use core::ffi::CStr;
5-
use core::fmt;
65
use core::iter::Iterator;
76
use core::mem::MaybeUninit;
87
use core::result::Result;
9-
use core::slice;
8+
use core::{fmt, slice};
109

1110
#[cfg(feature = "alloc")]
1211
use super::CString16;

uefi/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ extern crate self as uefi;
9696
pub mod data_types;
9797
#[cfg(feature = "alloc")]
9898
pub use self::data_types::CString16;
99-
pub use self::data_types::Identify;
100-
pub use self::data_types::{CStr16, CStr8, Char16, Char8, Event, Guid, Handle};
99+
pub use self::data_types::{CStr16, CStr8, Char16, Char8, Event, Guid, Handle, Identify};
101100
pub use uefi_macros::{cstr16, cstr8, entry, guid};
102101

103102
mod result;

uefi/src/mem.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! This is a utility module with helper methods for allocations/memory.
22
3-
use crate::ResultExt;
4-
use crate::{Result, Status};
3+
use crate::{Result, ResultExt, Status};
54
use ::alloc::boxed::Box;
65
use core::alloc::Layout;
76
use core::fmt::Debug;

uefi/src/proto/console/gop.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ use crate::util::usize_from_u32;
5555
use crate::{Result, Status};
5656
use core::fmt::{Debug, Formatter};
5757
use core::marker::PhantomData;
58-
use core::mem;
59-
use core::ptr;
58+
use core::{mem, ptr};
6059

6160
/// Provides access to the video hardware's frame buffer.
6261
///

0 commit comments

Comments
 (0)