Skip to content

Commit 3ee53a5

Browse files
medhefgonicholasbishop
authored andcommitted
uefi: Fix clippy hints
1 parent 9609873 commit 3ee53a5

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ trait InfoInternal: Align + ptr_meta::Pointee<Metadata = usize> {
6868
{
6969
// Calculate the final size of the struct.
7070
let name_length_ucs2 = name.as_slice_with_nul().len();
71-
let name_size = name_length_ucs2 * mem::size_of::<Char16>();
71+
let name_size = mem::size_of_val(name.as_slice_with_nul());
7272
let info_size = Self::name_offset() + name_size;
7373
let info_size = Self::round_up_to_alignment(info_size);
7474

uefi/src/proto/network/pxe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ impl DiscoverInfo {
680680
let required_size = core::mem::size_of::<bool>() * 4
681681
+ core::mem::size_of::<IpAddress>()
682682
+ core::mem::size_of::<u16>()
683-
+ core::mem::size_of::<Server>() * server_count;
683+
+ core::mem::size_of_val(srv_list);
684684

685685
if buffer.len() < required_size {
686686
return Err(Status::BUFFER_TOO_SMALL.into());

uefi/src/proto/rng.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl Rng {
1717
&mut self,
1818
algorithm_list: &'buf mut [RngAlgorithmType],
1919
) -> Result<&'buf [RngAlgorithmType], Option<usize>> {
20-
let mut algorithm_list_size = algorithm_list.len() * mem::size_of::<RngAlgorithmType>();
20+
let mut algorithm_list_size = mem::size_of_val(algorithm_list);
2121

2222
unsafe {
2323
(self.0.get_info)(

uefi/src/result/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
///! Facilities for dealing with UEFI operation results.
1+
//! Facilities for dealing with UEFI operation results.
2+
23
use core::fmt::Debug;
34

45
/// The error type that we use, essentially a status code + optional additional data

0 commit comments

Comments
 (0)