lanzaboote: fix clippy issues
This commit is contained in:
parent
4fb1e0d0dd
commit
7926ab9e5e
|
@ -147,16 +147,16 @@ fn initrd_location(initrd_efi: &mut RegularFile) -> Result<Range<usize>> {
|
||||||
.sections
|
.sections
|
||||||
.iter()
|
.iter()
|
||||||
.find(|s| s.name().unwrap() == ".initrd")
|
.find(|s| s.name().unwrap() == ".initrd")
|
||||||
.and_then(|s| {
|
.map(|s| {
|
||||||
let section_start: usize = s.pointer_to_raw_data.try_into().unwrap();
|
let section_start: usize = s.pointer_to_raw_data.try_into().unwrap();
|
||||||
let section_size: usize = s.size_of_raw_data.try_into().unwrap();
|
let section_size: usize = s.size_of_raw_data.try_into().unwrap();
|
||||||
|
|
||||||
Some(Range {
|
Range {
|
||||||
start: section_start,
|
start: section_start,
|
||||||
end: section_start + section_size,
|
end: section_start + section_size,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
.ok_or_else(|| Status::END_OF_FILE.into())
|
||||||
.ok_or(Status::END_OF_FILE.into())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check the signature of the initrd.
|
/// Check the signature of the initrd.
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
// Clippy doesn't like the lifetimes, but rustc wants them. 🤷
|
||||||
|
#![allow(clippy::needless_lifetimes)]
|
||||||
|
// Clippy doesn't understand that we exit with ? from the closure in
|
||||||
|
// and_then below and this can't be expressed with map.
|
||||||
|
#![allow(clippy::bind_instead_of_map)]
|
||||||
|
|
||||||
use alloc::{borrow::ToOwned, string::String};
|
use alloc::{borrow::ToOwned, string::String};
|
||||||
|
|
||||||
/// Extracts the data of a section of a PE file.
|
/// Extracts the data of a section of a PE file.
|
||||||
|
@ -20,6 +26,5 @@ pub fn pe_section<'a>(file_data: &'a [u8], section_name: &str) -> Option<&'a [u8
|
||||||
|
|
||||||
/// Extracts the data of a section of a PE file and returns it as a string.
|
/// Extracts the data of a section of a PE file and returns it as a string.
|
||||||
pub fn pe_section_as_string<'a>(file_data: &'a [u8], section_name: &str) -> Option<String> {
|
pub fn pe_section_as_string<'a>(file_data: &'a [u8], section_name: &str) -> Option<String> {
|
||||||
pe_section(file_data, section_name)
|
pe_section(file_data, section_name).map(|data| core::str::from_utf8(data).unwrap().to_owned())
|
||||||
.and_then(|data| Some(core::str::from_utf8(data).unwrap().to_owned()))
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue