ksud: make clippy happy (#2683)

e1be06240d/clippy_lints/src/format_args.rs (L168)
This commit is contained in:
5ec1cff
2025-07-18 17:10:40 +08:00
committed by ShirkNeko
parent c1c648e34d
commit a041b90891
9 changed files with 147 additions and 66 deletions

View File

@@ -366,13 +366,13 @@ pub fn run() -> Result<()> {
Commands::BootInfo { command } => match command {
BootInfo::CurrentKmi => {
let kmi = crate::boot_patch::get_current_kmi()?;
println!("{}", kmi);
println!("{kmi}");
// return here to avoid printing the error message
return Ok(());
}
BootInfo::SupportedKmi => {
let kmi = crate::assets::list_supported_kmi()?;
kmi.iter().for_each(|kmi| println!("{}", kmi));
kmi.iter().for_each(|kmi| println!("{kmi}"));
return Ok(());
}
},
@@ -384,7 +384,7 @@ pub fn run() -> Result<()> {
};
if let Err(e) = &result {
log::error!("Error: {:?}", e);
log::error!("Error: {e:?}");
}
result
}

View File

@@ -30,7 +30,7 @@ fn set_kernel_param(uid: u32) -> Result<()> {
fn get_pkg_uid(pkg: &str) -> Result<u32> {
// stat /data/data/<pkg>
let uid = rustix::fs::stat(format!("/data/data/{pkg}"))
.with_context(|| format!("stat /data/data/{}", pkg))?
.with_context(|| format!("stat /data/data/{pkg}"))?
.st_uid;
Ok(uid)
}

View File

@@ -31,7 +31,7 @@ pub fn on_post_data_fs() -> Result<()> {
} else {
// Then exec common post-fs-data scripts
if let Err(e) = crate::module::exec_common_scripts("post-fs-data.d", true) {
warn!("exec common post-fs-data scripts failed: {}", e);
warn!("exec common post-fs-data scripts failed: {e}");
}
}
@@ -44,7 +44,7 @@ pub fn on_post_data_fs() -> Result<()> {
if safe_mode {
warn!("safe mode, skip post-fs-data scripts and disable all modules!");
if let Err(e) = crate::module::disable_all_modules() {
warn!("disable all modules failed: {}", e);
warn!("disable all modules failed: {e}");
}
return Ok(());
}
@@ -58,7 +58,7 @@ pub fn on_post_data_fs() -> Result<()> {
}
if let Err(e) = restorecon::restorecon() {
warn!("restorecon failed: {}", e);
warn!("restorecon failed: {e}");
}
// load sepolicy.rule
@@ -67,7 +67,7 @@ pub fn on_post_data_fs() -> Result<()> {
}
if let Err(e) = crate::profile::apply_sepolies() {
warn!("apply root profile sepolicy failed: {}", e);
warn!("apply root profile sepolicy failed: {e}");
}
// mount temp dir
@@ -88,12 +88,12 @@ pub fn on_post_data_fs() -> Result<()> {
// exec modules post-fs-data scripts
// TODO: Add timeout
if let Err(e) = crate::module::exec_stage_script("post-fs-data", true) {
warn!("exec post-fs-data scripts failed: {}", e);
warn!("exec post-fs-data scripts failed: {e}");
}
// load system.prop
if let Err(e) = crate::module::load_system_prop() {
warn!("load system.prop failed: {}", e);
warn!("load system.prop failed: {e}");
}
// mount module systemlessly by magic mount
@@ -192,7 +192,7 @@ fn catch_bootlog(logname: &str, command: Vec<&str>) -> Result<()> {
};
if let Err(e) = result {
warn!("Failed to start logcat: {:#}", e);
warn!("Failed to start logcat: {e:#}");
}
Ok(())

View File

@@ -401,7 +401,7 @@ pub fn restore_uninstall_module(id: &str) -> Result<()> {
}
pub fn run_action(id: &str) -> Result<()> {
let action_script_path = format!("/data/adb/modules/{}/action.sh", id);
let action_script_path = format!("/data/adb/modules/{id}/action.sh");
exec_script(&action_script_path, true)
}

View File

@@ -70,9 +70,9 @@ pub fn apply_sepolies() -> Result<()> {
};
let sepolicy = sepolicy.path();
if sepolicy::apply_file(&sepolicy).is_ok() {
log::info!("profile sepolicy applied: {:?}", sepolicy);
log::info!("profile sepolicy applied: {sepolicy:?}");
} else {
log::info!("profile sepolicy apply failed: {:?}", sepolicy);
log::info!("profile sepolicy apply failed: {sepolicy:?}");
}
}
Ok(())

View File

@@ -697,7 +697,7 @@ fn apply_one_rule<'a>(statement: &'a PolicyStatement<'a>, strict: bool) -> Resul
for policy in policies {
if !rustix::process::ksu_set_policy(&FfiPolicy::from(policy)) {
log::warn!("apply rule: {:?} failed.", statement);
log::warn!("apply rule: {statement:?} failed.");
if strict {
return Err(anyhow::anyhow!("apply rule {:?} failed.", statement));
}

View File

@@ -104,12 +104,12 @@ pub fn is_safe_mode() -> bool {
|| getprop("ro.sys.safemode")
.filter(|prop| prop == "1")
.is_some();
log::info!("safemode: {}", safemode);
log::info!("safemode: {safemode}");
if safemode {
return true;
}
let safemode = ksucalls::check_kernel_safemode();
log::info!("kernel_safemode: {}", safemode);
log::info!("kernel_safemode: {safemode}");
safemode
}