ksud: minor tweaks

This commit is contained in:
tiann
2023-02-01 19:12:25 +08:00
parent 619dd1ace1
commit 681c4a3f0d
4 changed files with 10 additions and 10 deletions

View File

@@ -436,7 +436,7 @@ pub fn install_module(zip: String) -> Result<()> {
setsyscon(module_update_tmp_dir)?; setsyscon(module_update_tmp_dir)?;
let result = { let result = {
let module_dir = format!("{}/{}", module_update_tmp_dir, module_id); let module_dir = format!("{module_update_tmp_dir}/{module_id}");
ensure_clean_dir(&module_dir)?; ensure_clean_dir(&module_dir)?;
info!("module dir: {}", module_dir); info!("module dir: {}", module_dir);
@@ -451,7 +451,7 @@ pub fn install_module(zip: String) -> Result<()> {
let module_system_dir = module_system_dir.as_path(); let module_system_dir = module_system_dir.as_path();
if module_system_dir.exists() { if module_system_dir.exists() {
let path = module_system_dir.to_str().unwrap(); let path = module_system_dir.to_str().unwrap();
restore_syscon(&path)?; restore_syscon(path)?;
} }
exec_install_script(&zip) exec_install_script(&zip)
@@ -464,7 +464,7 @@ pub fn install_module(zip: String) -> Result<()> {
let _ = remove_dir_all(module_update_tmp_dir); let _ = remove_dir_all(module_update_tmp_dir);
// return if exec script failed // return if exec script failed
result.with_context(|| format!("Failed to execute install script for {}", module_id))?; result.with_context(|| format!("Failed to execute install script for {module_id}"))?;
// all done, rename the tmp image to modules_update.img // all done, rename the tmp image to modules_update.img
if std::fs::rename(tmp_module_img, defs::MODULE_UPDATE_IMG).is_err() { if std::fs::rename(tmp_module_img, defs::MODULE_UPDATE_IMG).is_err() {
@@ -553,7 +553,7 @@ pub fn uninstall_module(id: String) -> Result<()> {
} }
// santity check // santity check
let target_module_path = format!("{}/{}", update_dir, mid); let target_module_path = format!("{update_dir}/{mid}");
let target_module = Path::new(&target_module_path); let target_module = Path::new(&target_module_path);
if target_module.exists() { if target_module.exists() {
remove_dir_all(target_module)?; remove_dir_all(target_module)?;
@@ -566,7 +566,7 @@ pub fn uninstall_module(id: String) -> Result<()> {
} }
fn do_enable_module(module_dir: &str, mid: &str, enable: bool) -> Result<()> { fn do_enable_module(module_dir: &str, mid: &str, enable: bool) -> Result<()> {
let src_module_path = format!("{}/{}", module_dir, mid); let src_module_path = format!("{module_dir}/{mid}");
let src_module = Path::new(&src_module_path); let src_module = Path::new(&src_module_path);
if !src_module.exists() { if !src_module.exists() {
bail!("module: {} not found!", mid); bail!("module: {} not found!", mid);

View File

@@ -43,16 +43,16 @@ pub fn mount_overlay(lowerdir: &str, mnt: &str) -> Result<()> {
} }
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]
pub fn mount_ext4(src: &str, target: &str) -> Result<()> { pub fn mount_ext4(_src: &str, _target: &str) -> Result<()> {
unimplemented!() unimplemented!()
} }
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]
pub fn umount_dir(src: &str) -> Result<()> { pub fn umount_dir(_src: &str) -> Result<()> {
unimplemented!() unimplemented!()
} }
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]
pub fn mount_overlay(lowerdir: &str, mnt: &str) -> Result<()> { pub fn mount_overlay(_lowerdir: &str, _mnt: &str) -> Result<()> {
unimplemented!() unimplemented!()
} }

View File

@@ -718,7 +718,7 @@ fn apply_one_rule<'a>(statement: &'a PolicyStatement<'a>) -> Result<()> {
} }
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]
fn apply_one_rule<'a>(statement: &'a PolicyStatement<'a>) -> Result<()> { fn apply_one_rule<'a>(_statement: &'a PolicyStatement<'a>) -> Result<()> {
unimplemented!() unimplemented!()
} }

View File

@@ -66,7 +66,7 @@ pub fn getprop(prop: &str) -> Option<String> {
} }
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]
pub fn getprop(prop: &str) -> Option<String> { pub fn getprop(_prop: &str) -> Option<String> {
unimplemented!() unimplemented!()
} }