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 } => {
match command {
Susfs::Version => {
println!("{}", susfs::get_susfs_version())
}
Susfs::Status => {
println!("{}", susfs::get_susfs_status())
}
Susfs::Version => println!("{}", susfs::get_susfs_version()),
Susfs::Status => println!("{}", susfs::get_susfs_status()),
Susfs::Features => println!("{}", susfs::get_susfs_features()),
}
Ok(())

View File

@@ -1,3 +1,4 @@
#![allow(clippy::unreadable_literal)]
use libc::SYS_reboot;
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);
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 {
if get_susfs_version() == "unsupport" {
false
} else {
true
}
get_susfs_version() != "unsupport"
}
pub fn get_susfs_features() -> String {
@@ -77,6 +74,6 @@ pub fn get_susfs_features() -> String {
.iter()
.position(|&b| b == 0)
.unwrap_or(16);
String::from_utf8((&cmd.enabled_features[..features]).to_vec())
.unwrap_or("<invalid>".to_string())
String::from_utf8(cmd.enabled_features[..features].to_vec())
.unwrap_or_else(|_| "<invalid>".to_string())
}