From bc89c60977ace2325803d7f5246024f9de030402 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 2 Sep 2025 11:11:49 -0700 Subject: [PATCH] Run cargo fmt --- native/src/base/cxx_extern.rs | 28 ++++++++++++++++------------ native/src/boot/dtb.rs | 9 +++++---- native/src/init/mount.rs | 7 ++++--- native/src/sepolicy/cli.rs | 7 ++++--- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/native/src/base/cxx_extern.rs b/native/src/base/cxx_extern.rs index 695c0f82b..5f1c36452 100644 --- a/native/src/base/cxx_extern.rs +++ b/native/src/base/cxx_extern.rs @@ -111,9 +111,10 @@ pub(crate) unsafe fn readlinkat( unsafe extern "C" fn cp_afc_for_cxx(src: *const c_char, dest: *const c_char) -> bool { unsafe { if let Ok(src) = Utf8CStr::from_ptr(src) - && let Ok(dest) = Utf8CStr::from_ptr(dest) { - return src.copy_to(dest).log_cxx().is_ok(); - } + && let Ok(dest) = Utf8CStr::from_ptr(dest) + { + return src.copy_to(dest).log_cxx().is_ok(); + } false } } @@ -122,9 +123,10 @@ unsafe extern "C" fn cp_afc_for_cxx(src: *const c_char, dest: *const c_char) -> unsafe extern "C" fn mv_path_for_cxx(src: *const c_char, dest: *const c_char) -> bool { unsafe { if let Ok(src) = Utf8CStr::from_ptr(src) - && let Ok(dest) = Utf8CStr::from_ptr(dest) { - return src.move_to(dest).log_cxx().is_ok(); - } + && let Ok(dest) = Utf8CStr::from_ptr(dest) + { + return src.move_to(dest).log_cxx().is_ok(); + } false } } @@ -133,9 +135,10 @@ unsafe extern "C" fn mv_path_for_cxx(src: *const c_char, dest: *const c_char) -> unsafe extern "C" fn link_path_for_cxx(src: *const c_char, dest: *const c_char) -> bool { unsafe { if let Ok(src) = Utf8CStr::from_ptr(src) - && let Ok(dest) = Utf8CStr::from_ptr(dest) { - return src.link_to(dest).log_cxx().is_ok(); - } + && let Ok(dest) = Utf8CStr::from_ptr(dest) + { + return src.link_to(dest).log_cxx().is_ok(); + } false } } @@ -144,9 +147,10 @@ unsafe extern "C" fn link_path_for_cxx(src: *const c_char, dest: *const c_char) unsafe extern "C" fn clone_attr_for_cxx(src: *const c_char, dest: *const c_char) -> bool { unsafe { if let Ok(src) = Utf8CStr::from_ptr(src) - && let Ok(dest) = Utf8CStr::from_ptr(dest) { - return clone_attr(src, dest).log_cxx().is_ok(); - } + && let Ok(dest) = Utf8CStr::from_ptr(dest) + { + return clone_attr(src, dest).log_cxx().is_ok(); + } false } } diff --git a/native/src/boot/dtb.rs b/native/src/boot/dtb.rs index d438c38dc..e25d7d9dd 100644 --- a/native/src/boot/dtb.rs +++ b/native/src/boot/dtb.rs @@ -211,10 +211,11 @@ fn dtb_test(file: &Utf8CStr) -> LoggedResult { continue; } if let Some(mount_point) = child.property("mnt_point") - && mount_point.value == b"/system_root\0" { - ret = false; - break; - } + && mount_point.value == b"/system_root\0" + { + ret = false; + break; + } } } Ok(()) diff --git a/native/src/init/mount.rs b/native/src/init/mount.rs index 3daba8149..878e212f8 100644 --- a/native/src/init/mount.rs +++ b/native/src/init/mount.rs @@ -29,9 +29,10 @@ pub(crate) fn switch_root(path: &Utf8CStr) { if let Some(last_mount) = mounts .range::((Unbounded, Excluded(&info.target))) .last() - && info.target.starts_with(&format!("{}/", *last_mount)) { - continue; - } + && info.target.starts_with(&format!("{}/", *last_mount)) + { + continue; + } let mut target = info.target.clone(); let target = Utf8CStr::from_string(&mut target); diff --git a/native/src/sepolicy/cli.rs b/native/src/sepolicy/cli.rs index ca5542837..797f47300 100644 --- a/native/src/sepolicy/cli.rs +++ b/native/src/sepolicy/cli.rs @@ -128,9 +128,10 @@ pub unsafe extern "C" fn main( } if let Some(file) = cli.save - && !sepol.to_file(&file) { - log_err!("Cannot dump policy to {}", file)?; - } + && !sepol.to_file(&file) + { + log_err!("Cannot dump policy to {}", file)?; + } }; if res.is_ok() { 0 } else { 1 } }