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

@@ -19,28 +19,28 @@ const SERVICE_PATH: &str = "/data/adb/service.d/uid_scanner.sh";
pub fn start_uid_scanner_daemon() -> Result<()> {
if !fs::exists(SCANNER_PATH)? {
warn!("uid scanner binary not found at {}", SCANNER_PATH);
warn!("uid scanner binary not found at {SCANNER_PATH}");
return Ok(());
}
if let Err(e) = fs::set_permissions(SCANNER_PATH, fs::Permissions::from_mode(0o755)) {
warn!("failed to set permissions for {}: {}", SCANNER_PATH, e);
warn!("failed to set permissions for {SCANNER_PATH}: {e}");
}
#[cfg(unix)]
{
if let Err(e) = fs::create_dir_all(LINK_DIR) {
warn!("failed to create {}: {}", LINK_DIR, e);
warn!("failed to create {LINK_DIR}: {e}");
} else if !fs::exists(LINK_PATH)? {
match symlink(SCANNER_PATH, LINK_PATH) {
Ok(_) => info!("created symlink {} -> {}", SCANNER_PATH, LINK_PATH),
Err(e) => warn!("failed to create symlink: {}", e),
Ok(()) => info!("created symlink {SCANNER_PATH} -> {LINK_PATH}"),
Err(e) => warn!("failed to create symlink: {e}"),
}
}
}
if let Err(e) = fs::create_dir_all(SERVICE_DIR) {
warn!("failed to create {}: {}", SERVICE_DIR, e);
warn!("failed to create {SERVICE_DIR}: {e}");
}
if !fs::exists(SERVICE_PATH)? {
@@ -55,8 +55,8 @@ pub fn start_uid_scanner_daemon() -> Result<()> {
f.sync_all()?;
fs::set_permissions(SERVICE_PATH, fs::Permissions::from_mode(0o755))
}) {
Ok(_) => info!("created service script {}", SERVICE_PATH),
Err(e) => warn!("failed to write {}: {}", SERVICE_PATH, e),
Ok(()) => info!("created service script {SERVICE_PATH}"),
Err(e) => warn!("failed to write {SERVICE_PATH}: {e}"),
}
}
@@ -81,7 +81,7 @@ pub fn start_uid_scanner_daemon() -> Result<()> {
info!("uid scanner daemon started with pid: {}", child.id());
std::mem::drop(child);
}
Err(e) => warn!("failed to start uid scanner daemon: {}", e),
Err(e) => warn!("failed to start uid scanner daemon: {e}"),
}
Ok(())