chore(ksud): make cargo clippy happy

Signed-off-by: Tools-app <localhost.hutao@gmail.com>
This commit is contained in:
Tools-app
2025-11-30 09:00:04 +08:00
committed by 生于生时 亡于亡刻
parent b9d8da3415
commit aaf27a3db8
2 changed files with 9 additions and 14 deletions

View File

@@ -516,12 +516,10 @@ pub fn run() -> Result<()> {
} }
Commands::Susfs { command } => { Commands::Susfs { command } => {
match command { match command {
Susfs::Version => { Susfs::Version => println!("{}", susfs::get_susfs_version()),
println!("{}", susfs::get_susfs_version())
} Susfs::Status => println!("{}", susfs::get_susfs_status()),
Susfs::Status => {
println!("{}", susfs::get_susfs_status())
}
Susfs::Features => println!("{}", susfs::get_susfs_features()), Susfs::Features => println!("{}", susfs::get_susfs_features()),
} }
Ok(()) Ok(())

View File

@@ -1,3 +1,4 @@
#![allow(clippy::unreadable_literal)]
use libc::SYS_reboot; use libc::SYS_reboot;
const SUSFS_MAX_VERSION_BUFSIZE: usize = 16; const SUSFS_MAX_VERSION_BUFSIZE: usize = 16;
@@ -41,15 +42,11 @@ pub fn get_susfs_version() -> String {
} }
let ver = cmd.susfs_version.iter().position(|&b| b == 0).unwrap_or(16); let ver = cmd.susfs_version.iter().position(|&b| b == 0).unwrap_or(16);
String::from_utf8((&cmd.susfs_version[..ver]).to_vec()).unwrap_or("<invalid>".to_string()) String::from_utf8(cmd.susfs_version[..ver].to_vec()).unwrap_or_else(|_| "<invalid>".to_string())
} }
pub fn get_susfs_status() -> bool { pub fn get_susfs_status() -> bool {
if get_susfs_version() == "unsupport" { get_susfs_version() != "unsupport"
false
} else {
true
}
} }
pub fn get_susfs_features() -> String { pub fn get_susfs_features() -> String {
@@ -77,6 +74,6 @@ pub fn get_susfs_features() -> String {
.iter() .iter()
.position(|&b| b == 0) .position(|&b| b == 0)
.unwrap_or(16); .unwrap_or(16);
String::from_utf8((&cmd.enabled_features[..features]).to_vec()) String::from_utf8(cmd.enabled_features[..features].to_vec())
.unwrap_or("<invalid>".to_string()) .unwrap_or_else(|_| "<invalid>".to_string())
} }