chore: refine code

This commit is contained in:
5ec1cff
2024-11-22 19:20:13 +08:00
parent 520455a0df
commit b9883dfec3
2 changed files with 4 additions and 4 deletions

View File

@@ -71,7 +71,7 @@ impl Node {
if let Some(node) = node {
has_file |= if let Directory = node.file_type {
node.collect_module_files(&dir.join(&node.name))?
node.collect_module_files(dir.join(&node.name))?
} else {
true
}
@@ -146,7 +146,7 @@ fn collect_module_files() -> Result<Option<Node>> {
}
if has_file {
for partition in vec!["vendor", "system_ext", "product", "odm"] {
for partition in ["vendor", "system_ext", "product", "odm"] {
let path_of_root = Path::new("/").join(partition);
let path_of_system = Path::new("/system").join(partition);
if path_of_root.is_dir() && path_of_system.is_symlink() {
@@ -305,7 +305,7 @@ fn do_magic_mount<P: AsRef<Path>, WP: AsRef<Path>>(
Some(Gid::from_raw(metadata.gid())),
)?;
}
lsetfilecon(&work_dir_path, lgetfilecon(&path)?.as_str())?;
lsetfilecon(&work_dir_path, lgetfilecon(path)?.as_str())?;
}
if create_tmpfs {

View File

@@ -284,7 +284,7 @@ pub fn handle_updated_modules() -> Result<()> {
log::error!("Failed to remove old {}: {}", old_dir.display(), e);
}
}
if let Err(e) = rename(&module, &old_dir) {
if let Err(e) = rename(module, &old_dir) {
log::error!("Failed to move new module {}: {}", module.display(), e);
}
}