Address several clippy warnings

This commit is contained in:
topjohnwu
2025-03-03 02:15:06 -08:00
parent 2b47d47215
commit c6c1a17ae6
4 changed files with 26 additions and 15 deletions
+19 -9
View File
@@ -1,23 +1,33 @@
use crate::ffi::{backup_init, BootConfig, MagiskInit};
use base::{debug, path, BytesExt, MappedFile};
use std::ffi::CStr;
use base::{path, BytesExt, MappedFile};
impl BootConfig {
#[allow(unused_imports, unused_unsafe)]
pub(crate) fn print(&self) {
use base::{debug, Utf8CStr};
debug!("skip_initramfs=[{}]", self.skip_initramfs);
debug!("force_normal_boot=[{}]", self.force_normal_boot);
debug!("rootwait=[{}]", self.rootwait);
unsafe {
debug!("slot=[{:?}]", CStr::from_ptr(self.slot.as_ptr()));
debug!("dt_dir=[{:?}]", CStr::from_ptr(self.dt_dir.as_ptr()));
debug!(
"fstab_suffix=[{:?}]",
CStr::from_ptr(self.fstab_suffix.as_ptr())
"slot=[{}]",
Utf8CStr::from_ptr_unchecked(self.slot.as_ptr())
);
debug!("hardware=[{:?}]", CStr::from_ptr(self.hardware.as_ptr()));
debug!(
"hardware.platform=[{:?}]",
CStr::from_ptr(self.hardware_plat.as_ptr())
"dt_dir=[{}]",
Utf8CStr::from_ptr_unchecked(self.dt_dir.as_ptr())
);
debug!(
"fstab_suffix=[{}]",
Utf8CStr::from_ptr_unchecked(self.fstab_suffix.as_ptr())
);
debug!(
"hardware=[{}]",
Utf8CStr::from_ptr_unchecked(self.hardware.as_ptr())
);
debug!(
"hardware.platform=[{}]",
Utf8CStr::from_ptr_unchecked(self.hardware_plat.as_ptr())
);
}
debug!("emulator=[{}]", self.emulator);
+2
View File
@@ -81,6 +81,7 @@ impl MagiskInit {
// Redirect original init to magiskinit
let v = map.patch(from.as_bytes(), to.as_bytes());
#[allow(unused_variables)]
for off in &v {
debug!("Patch @ {:#010X} [{}] -> [{}]", off, from, to);
}
@@ -100,6 +101,7 @@ impl MagiskInit {
// Redirect original init to magiskinit
let v = map.patch(from.as_bytes(), to.as_bytes());
#[allow(unused_variables)]
for off in &v {
debug!("Patch @ {:#010X} [{}] -> [{}]", off, from, to);
}