summaryrefslogtreecommitdiff
path: root/test/test.rs
diff options
context:
space:
mode:
authorCostin-Robert Sin <sin.costinrobert@gmail.com>2022-06-21 15:36:05 +0300
committerCostin-Robert Sin <sin.costinrobert@gmail.com>2022-06-24 00:35:52 +0300
commit3e6cb639f0d9afde57d9cc03526c2e488641231b (patch)
treec882f2947fa5b22e67a58918c45012655b892b30 /test/test.rs
parent8f08a69c28fad5ee875d69e4c8a1b8eed2203cb4 (diff)
downloadnix-3e6cb639f0d9afde57d9cc03526c2e488641231b.zip
Fix all formating problems to pass CI formating test
Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
Diffstat (limited to 'test/test.rs')
-rw-r--r--test/test.rs62
1 files changed, 35 insertions, 27 deletions
diff --git a/test/test.rs b/test/test.rs
index 240d6e37..f725ef97 100644
--- a/test/test.rs
+++ b/test/test.rs
@@ -10,38 +10,46 @@ mod sys;
#[cfg(not(target_os = "redox"))]
mod test_dir;
mod test_fcntl;
-#[cfg(any(target_os = "android",
- target_os = "linux"))]
+#[cfg(any(target_os = "android", target_os = "linux"))]
mod test_kmod;
-#[cfg(target_os = "freebsd")]
-mod test_nmount;
-#[cfg(any(target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fushsia",
- target_os = "linux",
- target_os = "netbsd"))]
+#[cfg(any(
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "fushsia",
+ target_os = "linux",
+ target_os = "netbsd"
+))]
mod test_mq;
#[cfg(not(target_os = "redox"))]
mod test_net;
mod test_nix_path;
-mod test_resource;
+#[cfg(target_os = "freebsd")]
+mod test_nmount;
mod test_poll;
-#[cfg(not(any(target_os = "redox", target_os = "fuchsia", target_os = "haiku")))]
+#[cfg(not(any(
+ target_os = "redox",
+ target_os = "fuchsia",
+ target_os = "haiku"
+)))]
mod test_pty;
-#[cfg(any(target_os = "android",
- target_os = "dragonfly",
- target_os = "linux"))]
+mod test_resource;
+#[cfg(any(
+ target_os = "android",
+ target_os = "dragonfly",
+ target_os = "linux"
+))]
mod test_sched;
-#[cfg(any(target_os = "android",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "linux",
- target_os = "macos"))]
+#[cfg(any(
+ target_os = "android",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+ target_os = "linux",
+ target_os = "macos"
+))]
mod test_sendfile;
mod test_stat;
mod test_time;
-mod test_unistd;
#[cfg(all(
any(
target_os = "freebsd",
@@ -53,15 +61,15 @@ mod test_unistd;
feature = "signal"
))]
mod test_timer;
+mod test_unistd;
+use nix::unistd::{chdir, getcwd, read};
+use parking_lot::{Mutex, RwLock, RwLockWriteGuard};
use std::os::unix::io::RawFd;
use std::path::PathBuf;
-use parking_lot::{Mutex, RwLock, RwLockWriteGuard};
-use nix::unistd::{chdir, getcwd, read};
-
/// Helper function analogous to `std::io::Read::read_exact`, but for `RawFD`s
-fn read_exact(f: RawFd, buf: &mut [u8]) {
+fn read_exact(f: RawFd, buf: &mut [u8]) {
let mut len = 0;
while len < buf.len() {
// get_mut would be better than split_at_mut, but it requires nightly
@@ -92,13 +100,13 @@ lazy_static! {
/// RAII object that restores a test's original directory on drop
struct DirRestore<'a> {
d: PathBuf,
- _g: RwLockWriteGuard<'a, ()>
+ _g: RwLockWriteGuard<'a, ()>,
}
impl<'a> DirRestore<'a> {
fn new() -> Self {
let guard = crate::CWD_LOCK.write();
- DirRestore{
+ DirRestore {
_g: guard,
d: getcwd().unwrap(),
}