Fix code style

This commit is contained in:
王宇逸
2025-02-26 00:05:55 +08:00
parent abcbd88175
commit d24c6a29f5
3 changed files with 14 additions and 4 deletions

View File

@@ -543,7 +543,12 @@ impl FileAttr {
SystemTime::new(self.stat.st_atim.tv_sec as i64, self.stat.st_atim.tv_nsec as i64)
}
#[cfg(any(target_os = "freebsd", target_os = "openbsd", target_vendor = "apple", target_os = "cygwin"))]
#[cfg(any(
target_os = "freebsd",
target_os = "openbsd",
target_vendor = "apple",
target_os = "cygwin",
))]
pub fn created(&self) -> io::Result<SystemTime> {
SystemTime::new(self.stat.st_birthtime as i64, self.stat.st_birthtime_nsec as i64)
}

View File

@@ -372,7 +372,8 @@ mod imp {
// this way someone on any unix-y OS can check that all these compile
if cfg!(all(target_os = "linux", not(target_env = "musl"))) {
install_main_guard_linux(page_size)
} else if cfg!(any(all(target_os = "linux", target_env = "musl"), target_os = "cygwin")) {
} else if cfg!(any(all(target_os = "linux", target_env = "musl"), target_os = "cygwin"))
{
install_main_guard_linux_musl(page_size)
} else if cfg!(target_os = "freebsd") {
install_main_guard_freebsd(page_size)

View File

@@ -95,9 +95,13 @@ fn getrandom(mut bytes: &mut [u8], insecure: bool) {
let flags = if insecure {
if GRND_INSECURE_AVAILABLE.load(Relaxed) {
#[cfg(target_os = "cygwin")]
{ libc::GRND_NONBLOCK }
{
libc::GRND_NONBLOCK
}
#[cfg(not(target_os = "cygwin"))]
{ libc::GRND_INSECURE }
{
libc::GRND_INSECURE
}
} else {
libc::GRND_NONBLOCK
}