chore(ksud): enable clippy::all, clippy::pedantic && make clippy happy (#617)

* Revert "chore(ksud): bump ksud's deps (#585)"
* Because it may cause compilation errors.

This reverts commit c8020b2066.

* chore(ksud): remove unused Result

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

* chore(ksud): enable clippy::all, clippy::pedantic && make clippy happy

https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or

https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args

https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_items

https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls

https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pub_crate
...
and use some #![allow(...)] or #[allow(...)]

Signed-off-by: Tools-app <localhost.hutao@gmail.com>

---------

Signed-off-by: Tools-app <localhost.hutao@gmail.com>
This commit is contained in:
生于生时 亡于亡刻
2025-11-22 06:09:45 +08:00
committed by ShirkNeko
parent 6898d82daf
commit 27f6db889a
20 changed files with 829 additions and 784 deletions

View File

@@ -21,9 +21,9 @@ pub fn on_post_data_fs() -> Result<()> {
}
#[cfg(unix)]
let _ = catch_bootlog("logcat", vec!["logcat"]);
let _ = catch_bootlog("logcat", &["logcat"]);
#[cfg(unix)]
let _ = catch_bootlog("dmesg", vec!["dmesg", "-w"]);
let _ = catch_bootlog("dmesg", &["dmesg", "-w"]);
if utils::has_magisk() {
warn!("Magisk detected, skip post-fs-data!");
@@ -159,24 +159,20 @@ fn run_stage(stage: &str, block: bool) {
}
}
pub fn on_services() -> Result<()> {
pub fn on_services() {
info!("on_services triggered!");
run_stage("service", false);
Ok(())
}
pub fn on_boot_completed() -> Result<()> {
pub fn on_boot_completed() {
ksucalls::report_boot_complete();
info!("on_boot_completed triggered!");
run_stage("boot-completed", false);
Ok(())
}
#[cfg(unix)]
fn catch_bootlog(logname: &str, command: Vec<&str>) -> Result<()> {
fn catch_bootlog(logname: &str, command: &[&str]) -> Result<()> {
use std::os::unix::process::CommandExt;
use std::process::Stdio;
@@ -192,7 +188,7 @@ fn catch_bootlog(logname: &str, command: Vec<&str>) -> Result<()> {
let bootlog = std::fs::File::create(bootlog)?;
let mut args = vec!["-s", "9", "30s"];
args.extend_from_slice(&command);
args.extend_from_slice(command);
// timeout -s 9 30s logcat > boot.log
let result = unsafe {
std::process::Command::new("timeout")