From 68bb9c7f0b473446530fb9207318975f7bbc2c7d Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Thu, 20 Feb 2025 15:39:00 -0700 Subject: [PATCH 1/2] Address clippy lints Fix the following: - clippy::manual_c_str_literals - clippy::needless_lifetimes - clippy::question_mark Signed-off-by: Tim Crawford --- src/fde.rs | 2 +- src/image/mod.rs | 2 +- src/security.rs | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/fde.rs b/src/fde.rs index 72f691d..4eef962 100644 --- a/src/fde.rs +++ b/src/fde.rs @@ -44,7 +44,7 @@ impl HiiStringProtocol { let mut len = data.len(); Result::from((self.GetString)( self, - b"en-US\0".as_ptr(), + c"en-US".as_ptr() as *const u8, PackageList, StringId, data.as_mut_ptr(), diff --git a/src/image/mod.rs b/src/image/mod.rs index b9b8ac6..539d0c1 100644 --- a/src/image/mod.rs +++ b/src/image/mod.rs @@ -18,7 +18,7 @@ pub struct ImageRoi<'a> { image: &'a Image, } -impl<'a> ImageRoi<'a> { +impl ImageRoi<'_> { /// Draw the ROI on a window pub fn draw(&self, renderer: &mut R, x: i32, mut y: i32) { let stride = self.image.w; diff --git a/src/security.rs b/src/security.rs index 013e727..61c0a82 100644 --- a/src/security.rs +++ b/src/security.rs @@ -63,11 +63,7 @@ fn confirm(display: &mut Display) -> Result<()> { // } Style let ui = Ui::new()?; - - let rng = match Rng::one() { - Ok(ok) => ok, - Err(err) => return Err(err), - }; + let rng = Rng::one()?; // Clear any previous keys let _ = key(false); From 3a032829bacaa98b5816aad23c28bb8266d1a7c1 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Thu, 20 Feb 2025 15:39:39 -0700 Subject: [PATCH 2/2] Format code cargo +1.85.0 fmt Signed-off-by: Tim Crawford --- src/fde.rs | 8 +++----- src/security.rs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/fde.rs b/src/fde.rs index 4eef962..ca41368 100644 --- a/src/fde.rs +++ b/src/fde.rs @@ -15,7 +15,7 @@ use std::uefi::hii::{AnimationId, ImageId, StringId}; use std::uefi::text::TextInputKey; use crate::display::{Display, Output}; -use crate::key::{raw_key, Key}; +use crate::key::{Key, raw_key}; use crate::ui::Ui; // TODO: Move to uefi library { @@ -511,9 +511,7 @@ fn form_display_inner(form: &Form, user_input: &mut UserInput) -> Result<()> { if let Some(op) = statement.OpCode() { macro_rules! cast { - ($type:ty) => {{ - op.cast::<$type>() - }}; + ($type:ty) => {{ op.cast::<$type>() }}; } match op.OpCode { IfrOpCode::Action => { @@ -574,7 +572,7 @@ fn form_display_inner(form: &Form, user_input: &mut UserInput) -> Result<()> { IfrTypeValueEnum::U32(value) => format!("{value}"), IfrTypeValueEnum::U64(value) => format!("{value}"), IfrTypeValueEnum::Bool(value) => { - return ui.draw_check_box(display, x, y, *value) + return ui.draw_check_box(display, x, y, *value); } other => format!("{other:?}"), }; diff --git a/src/security.rs b/src/security.rs index 61c0a82..90622e6 100644 --- a/src/security.rs +++ b/src/security.rs @@ -9,7 +9,7 @@ use std::proto::Protocol; use std::uefi::{boot::InterfaceType, reset::ResetType}; use crate::display::{Display, Output}; -use crate::key::{key, Key}; +use crate::key::{Key, key}; use crate::rng::Rng; use crate::ui::Ui;