Skip to content

Commit c001431

Browse files
Merge pull request #1485 from nicholasbishop/bishop-fix-183
Fix clippy::needless_lifetimes in Rust 1.83 and ShimLock ABI on ia32
2 parents 72d484f + 8e90994 commit c001431

File tree

17 files changed

+54
-45
lines changed

17 files changed

+54
-45
lines changed

uefi/src/boot.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,7 @@ pub enum LoadImageSource<'a> {
16131613
},
16141614
}
16151615

1616-
impl<'a> LoadImageSource<'a> {
1616+
impl LoadImageSource<'_> {
16171617
/// Returns the raw FFI parameters for `load_image`.
16181618
#[must_use]
16191619
pub(crate) fn to_ffi_params(
@@ -1677,7 +1677,7 @@ pub enum SearchType<'guid> {
16771677
ByRegisterNotify(ProtocolSearchKey),
16781678
}
16791679

1680-
impl<'guid> SearchType<'guid> {
1680+
impl SearchType<'_> {
16811681
/// Constructs a new search type for a specified protocol.
16821682
#[must_use]
16831683
pub const fn from_proto<P: ProtocolPointer + ?Sized>() -> Self {

uefi/src/data_types/owned_strs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl TryFrom<Vec<u16>> for CString16 {
170170
}
171171
}
172172

173-
impl<'a> TryFrom<&UnalignedSlice<'a, u16>> for CString16 {
173+
impl TryFrom<&UnalignedSlice<'_, u16>> for CString16 {
174174
type Error = FromSliceWithNulError;
175175

176176
fn try_from(input: &UnalignedSlice<u16>) -> Result<Self, Self::Error> {
@@ -193,7 +193,7 @@ impl From<&CString16> for String {
193193
}
194194
}
195195

196-
impl<'a> UnalignedSlice<'a, u16> {
196+
impl UnalignedSlice<'_, u16> {
197197
/// Copies `self` to a new [`CString16`].
198198
pub fn to_cstring16(&self) -> Result<CString16, FromSliceWithNulError> {
199199
CString16::try_from(self)

uefi/src/data_types/strs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ impl PartialEq<CString16> for &CStr16 {
720720
}
721721
}
722722

723-
impl<'a> UnalignedSlice<'a, u16> {
723+
impl UnalignedSlice<'_, u16> {
724724
/// Create a [`CStr16`] from an [`UnalignedSlice`] using an aligned
725725
/// buffer for storage. The lifetime of the output is tied to `buf`,
726726
/// not `self`.

uefi/src/data_types/unaligned_slice.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl<'a, T: Copy> UnalignedSlice<'a, T> {
134134
}
135135
}
136136

137-
impl<'a, T: Copy + Debug> Debug for UnalignedSlice<'a, T> {
137+
impl<T: Copy + Debug> Debug for UnalignedSlice<'_, T> {
138138
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
139139
f.debug_list().entries(self.iter()).finish()
140140
}
@@ -175,7 +175,7 @@ pub struct UnalignedSliceIntoIter<'a, T: Copy> {
175175
index: usize,
176176
}
177177

178-
impl<'a, T: Copy> Iterator for UnalignedSliceIntoIter<'a, T> {
178+
impl<T: Copy> Iterator for UnalignedSliceIntoIter<'_, T> {
179179
type Item = T;
180180

181181
fn next(&mut self) -> Option<T> {
@@ -192,7 +192,7 @@ pub struct UnalignedSliceIter<'a, T: Copy> {
192192
index: usize,
193193
}
194194

195-
impl<'a, T: Copy> Iterator for UnalignedSliceIter<'a, T> {
195+
impl<T: Copy> Iterator for UnalignedSliceIter<'_, T> {
196196
type Item = T;
197197

198198
fn next(&mut self) -> Option<T> {

uefi/src/fs/path/path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub struct Components<'a> {
110110
i: usize,
111111
}
112112

113-
impl<'a> Iterator for Components<'a> {
113+
impl Iterator for Components<'_> {
114114
// Attention. We can't iterate over &'Ctr16, as we would break any guarantee
115115
// made for the terminating null character.
116116
type Item = CString16;

uefi/src/helpers/logger.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl<'writer, 'a, W: fmt::Write> DecoratedLog<'writer, 'a, W> {
217217
}
218218
}
219219

220-
impl<'writer, 'a, W: fmt::Write> fmt::Write for DecoratedLog<'writer, 'a, W> {
220+
impl<W: fmt::Write> fmt::Write for DecoratedLog<'_, '_, W> {
221221
fn write_str(&mut self, s: &str) -> fmt::Result {
222222
// Split the input string into lines
223223
let mut lines = s.lines();

uefi/src/mem/memory_map/impl_.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'a> MemoryMapRef<'a> {
5757
}
5858
}
5959

60-
impl<'a> MemoryMap for MemoryMapRef<'a> {
60+
impl MemoryMap for MemoryMapRef<'_> {
6161
fn meta(&self) -> MemoryMapMeta {
6262
self.meta
6363
}
@@ -119,7 +119,7 @@ impl<'a> MemoryMapRefMut<'a> {
119119
}
120120
}
121121

122-
impl<'a> MemoryMap for MemoryMapRefMut<'a> {
122+
impl MemoryMap for MemoryMapRefMut<'_> {
123123
fn meta(&self) -> MemoryMapMeta {
124124
self.meta
125125
}
@@ -144,7 +144,7 @@ impl<'a> MemoryMap for MemoryMapRefMut<'a> {
144144
}
145145
}
146146

147-
impl<'a> MemoryMapMut for MemoryMapRefMut<'a> {
147+
impl MemoryMapMut for MemoryMapRefMut<'_> {
148148
fn sort(&mut self) {
149149
self.qsort(0, self.len - 1);
150150
}
@@ -154,7 +154,7 @@ impl<'a> MemoryMapMut for MemoryMapRefMut<'a> {
154154
}
155155
}
156156

157-
impl<'a> MemoryMapRefMut<'a> {
157+
impl MemoryMapRefMut<'_> {
158158
/// Hoare partition scheme for quicksort.
159159
/// Must be called with `low` and `high` being indices within bounds.
160160
fn qsort(&mut self, low: usize, high: usize) {

uefi/src/proto/console/gop.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ pub struct ModeIter<'gop> {
414414
max: u32,
415415
}
416416

417-
impl<'gop> Iterator for ModeIter<'gop> {
417+
impl Iterator for ModeIter<'_> {
418418
type Item = Mode;
419419

420420
fn next(&mut self) -> Option<Self::Item> {
@@ -435,7 +435,7 @@ impl<'gop> Iterator for ModeIter<'gop> {
435435
}
436436
}
437437

438-
impl<'gop> Debug for ModeIter<'gop> {
438+
impl Debug for ModeIter<'_> {
439439
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
440440
f.debug_struct("ModeIter")
441441
.field("current", &self.current)
@@ -557,7 +557,7 @@ pub struct FrameBuffer<'gop> {
557557
_lifetime: PhantomData<&'gop mut u8>,
558558
}
559559

560-
impl<'gop> FrameBuffer<'gop> {
560+
impl FrameBuffer<'_> {
561561
/// Access the raw framebuffer pointer
562562
///
563563
/// To use this pointer safely and correctly, you must...

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ pub struct OutputModeIter<'out> {
255255
max: usize,
256256
}
257257

258-
impl<'out> Iterator for OutputModeIter<'out> {
258+
impl Iterator for OutputModeIter<'_> {
259259
type Item = OutputMode;
260260

261261
fn next(&mut self) -> Option<Self::Item> {

uefi/src/proto/device_path/device_path_gen.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -3165,7 +3165,7 @@ pub enum DevicePathNodeEnum<'a> {
31653165
BiosBootSpecBootSpecification(&'a bios_boot_spec::BootSpecification),
31663166
}
31673167

3168-
impl<'a> TryFrom<&DevicePathNode> for DevicePathNodeEnum<'a> {
3168+
impl TryFrom<&DevicePathNode> for DevicePathNodeEnum<'_> {
31693169
type Error = NodeConversionError;
31703170
fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error> {
31713171
Ok(match node.full_type() {
@@ -3516,7 +3516,7 @@ pub mod build {
35163516
pub vendor_defined_data: &'a [u8],
35173517
}
35183518

3519-
unsafe impl<'a> BuildNode for Vendor<'a> {
3519+
unsafe impl BuildNode for Vendor<'_> {
35203520
fn size_in_bytes(&self) -> Result<u16, BuildError> {
35213521
let size = 20usize + size_of_val(self.vendor_defined_data);
35223522
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -3692,7 +3692,7 @@ pub mod build {
36923692
pub cid_str: &'a [u8],
36933693
}
36943694

3695-
unsafe impl<'a> BuildNode for Expanded<'a> {
3695+
unsafe impl BuildNode for Expanded<'_> {
36963696
fn size_in_bytes(&self) -> Result<u16, BuildError> {
36973697
let size = 16usize
36983698
+ size_of_val(self.hid_str)
@@ -3744,7 +3744,7 @@ pub mod build {
37443744
pub adr: &'a AdrSlice,
37453745
}
37463746

3747-
unsafe impl<'a> BuildNode for Adr<'a> {
3747+
unsafe impl BuildNode for Adr<'_> {
37483748
fn size_in_bytes(&self) -> Result<u16, BuildError> {
37493749
let size = 4usize + size_of_val(self.adr);
37503750
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -4129,7 +4129,7 @@ pub mod build {
41294129
pub serial_number: &'a [u16],
41304130
}
41314131

4132-
unsafe impl<'a> BuildNode for UsbWwid<'a> {
4132+
unsafe impl BuildNode for UsbWwid<'_> {
41334133
fn size_in_bytes(&self) -> Result<u16, BuildError> {
41344134
let size = 10usize + size_of_val(self.serial_number);
41354135
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -4638,7 +4638,7 @@ pub mod build {
46384638
pub vendor_defined_data: &'a [u8],
46394639
}
46404640

4641-
unsafe impl<'a> BuildNode for Vendor<'a> {
4641+
unsafe impl BuildNode for Vendor<'_> {
46424642
fn size_in_bytes(&self) -> Result<u16, BuildError> {
46434643
let size = 20usize + size_of_val(self.vendor_defined_data);
46444644
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -4742,7 +4742,7 @@ pub mod build {
47424742
pub iscsi_target_name: &'a [u8],
47434743
}
47444744

4745-
unsafe impl<'a> BuildNode for Iscsi<'a> {
4745+
unsafe impl BuildNode for Iscsi<'_> {
47464746
fn size_in_bytes(&self) -> Result<u16, BuildError> {
47474747
let size = 18usize + size_of_val(self.iscsi_target_name);
47484748
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -4835,7 +4835,7 @@ pub mod build {
48354835
pub value: &'a [u8],
48364836
}
48374837

4838-
unsafe impl<'a> BuildNode for Uri<'a> {
4838+
unsafe impl BuildNode for Uri<'_> {
48394839
fn size_in_bytes(&self) -> Result<u16, BuildError> {
48404840
let size = 4usize + size_of_val(self.value);
48414841
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -5080,7 +5080,7 @@ pub mod build {
50805080
pub addresses: &'a [IpAddress],
50815081
}
50825082

5083-
unsafe impl<'a> BuildNode for Dns<'a> {
5083+
unsafe impl BuildNode for Dns<'_> {
50845084
fn size_in_bytes(&self) -> Result<u16, BuildError> {
50855085
let size = 5usize + size_of_val(self.addresses);
50865086
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -5156,7 +5156,7 @@ pub mod build {
51565156
pub vendor_guid_and_data: Option<RestServiceVendorData<'a>>,
51575157
}
51585158

5159-
unsafe impl<'a> BuildNode for RestService<'a> {
5159+
unsafe impl BuildNode for RestService<'_> {
51605160
fn size_in_bytes(&self) -> Result<u16, BuildError> {
51615161
let size = 6usize + self.build_size_vendor_guid_and_data();
51625162
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -5199,7 +5199,7 @@ pub mod build {
51995199
pub subsystem_nqn: &'a [u8],
52005200
}
52015201

5202-
unsafe impl<'a> BuildNode for NvmeOfNamespace<'a> {
5202+
unsafe impl BuildNode for NvmeOfNamespace<'_> {
52035203
fn size_in_bytes(&self) -> Result<u16, BuildError> {
52045204
let size = 21usize + size_of_val(self.subsystem_nqn);
52055205
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -5244,7 +5244,7 @@ pub mod build {
52445244
pub vendor_defined_data: &'a [u8],
52455245
}
52465246

5247-
impl<'a> RestService<'a> {
5247+
impl RestService<'_> {
52485248
fn build_size_vendor_guid_and_data(&self) -> usize {
52495249
if let Some(src) = &self.vendor_guid_and_data {
52505250
assert!(self.service_type == device_path::messaging::RestServiceType::VENDOR);
@@ -5393,7 +5393,7 @@ pub mod build {
53935393
pub vendor_defined_data: &'a [u8],
53945394
}
53955395

5396-
unsafe impl<'a> BuildNode for Vendor<'a> {
5396+
unsafe impl BuildNode for Vendor<'_> {
53975397
fn size_in_bytes(&self) -> Result<u16, BuildError> {
53985398
let size = 20usize + size_of_val(self.vendor_defined_data);
53995399
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -5433,7 +5433,7 @@ pub mod build {
54335433
pub path_name: &'a CStr16,
54345434
}
54355435

5436-
unsafe impl<'a> BuildNode for FilePath<'a> {
5436+
unsafe impl BuildNode for FilePath<'_> {
54375437
fn size_in_bytes(&self) -> Result<u16, BuildError> {
54385438
let size = 4usize + size_of_val(self.path_name);
54395439
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -5499,7 +5499,7 @@ pub mod build {
54995499
pub data: &'a [u8],
55005500
}
55015501

5502-
unsafe impl<'a> BuildNode for PiwgFirmwareFile<'a> {
5502+
unsafe impl BuildNode for PiwgFirmwareFile<'_> {
55035503
fn size_in_bytes(&self) -> Result<u16, BuildError> {
55045504
let size = 4usize + size_of_val(self.data);
55055505
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -5532,7 +5532,7 @@ pub mod build {
55325532
pub data: &'a [u8],
55335533
}
55345534

5535-
unsafe impl<'a> BuildNode for PiwgFirmwareVolume<'a> {
5535+
unsafe impl BuildNode for PiwgFirmwareVolume<'_> {
55365536
fn size_in_bytes(&self) -> Result<u16, BuildError> {
55375537
let size = 4usize + size_of_val(self.data);
55385538
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)
@@ -5692,7 +5692,7 @@ pub mod build {
56925692
pub description_string: &'a [u8],
56935693
}
56945694

5695-
unsafe impl<'a> BuildNode for BootSpecification<'a> {
5695+
unsafe impl BuildNode for BootSpecification<'_> {
56965696
fn size_in_bytes(&self) -> Result<u16, BuildError> {
56975697
let size = 8usize + size_of_val(self.description_string);
56985698
u16::try_from(size).map_err(|_| BuildError::NodeTooBig)

uefi/src/proto/driver/component_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ pub struct LanguageIter<'a> {
265265
kind: LanguageIterKind,
266266
}
267267

268-
impl<'a> LanguageIter<'a> {
268+
impl LanguageIter<'_> {
269269
const fn new(
270270
languages: *const u8,
271271
kind: LanguageIterKind,

uefi/src/proto/shim/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ pub struct Hashes {
4545

4646
// These macros set the correct calling convention for the Shim protocol methods.
4747

48-
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
48+
#[cfg(target_arch = "x86")]
49+
macro_rules! shim_function {
50+
(fn $args:tt -> $return_type:ty) => (extern "cdecl" fn $args -> $return_type)
51+
}
52+
53+
#[cfg(target_arch = "x86_64")]
4954
macro_rules! shim_function {
5055
(fn $args:tt -> $return_type:ty) => (extern "sysv64" fn $args -> $return_type)
5156
}

uefi/src/proto/tcg/v1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ pub struct EventLog<'a> {
258258
is_truncated: bool,
259259
}
260260

261-
impl<'a> EventLog<'a> {
261+
impl EventLog<'_> {
262262
pub(super) const unsafe fn new(
263263
location: *const u8,
264264
last_entry: *const u8,

uefi/src/proto/tcg/v2.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ struct AlgorithmDigestSize {
231231
#[derive(Clone, Debug)]
232232
struct AlgorithmDigestSizes<'a>(UnalignedSlice<'a, AlgorithmDigestSize>);
233233

234-
impl<'a> AlgorithmDigestSizes<'a> {
234+
impl AlgorithmDigestSizes<'_> {
235235
fn get_size(&self, alg: AlgorithmId) -> Option<u16> {
236236
self.0.iter().find_map(|elem| {
237237
if { elem.algorithm_id } == alg {
@@ -332,7 +332,7 @@ pub struct EventLog<'a> {
332332
is_truncated: bool,
333333
}
334334

335-
impl<'a> EventLog<'a> {
335+
impl EventLog<'_> {
336336
/// Iterator of events in the log.
337337
#[must_use]
338338
pub fn iter(&self) -> EventLogIter {
@@ -384,7 +384,7 @@ pub struct PcrEventDigests<'a> {
384384
algorithm_digest_sizes: AlgorithmDigestSizes<'a>,
385385
}
386386

387-
impl<'a> Debug for PcrEventDigests<'a> {
387+
impl Debug for PcrEventDigests<'_> {
388388
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
389389
f.debug_list().entries(self.clone()).finish()
390390
}

xtask/src/device_path/group.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl NodeGroup {
182182
#(#variants),*
183183
}
184184

185-
impl<'a> TryFrom<&DevicePathNode> for DevicePathNodeEnum<'a> {
185+
impl TryFrom<&DevicePathNode> for DevicePathNodeEnum<'_> {
186186
type Error = NodeConversionError;
187187

188188
fn try_from(node: &DevicePathNode) -> Result<Self, Self::Error> {

0 commit comments

Comments
 (0)