From 7b452f3bfeddc84f7fcdf87642a4a02b4afb32cc Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 9 Jun 2020 13:37:59 +0200 Subject: [PATCH] style(nproc): reformat with rustfmt --- src/uu/nproc/src/nproc.rs | 6 +++--- tests/by-util/test_nproc.rs | 19 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index 82ef415a4..07a4a1b05 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -7,9 +7,9 @@ // spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr threadstr sysconf +extern crate clap; extern crate getopts; extern crate num_cpus; -extern crate clap; #[cfg(unix)] extern crate libc; @@ -17,8 +17,8 @@ extern crate libc; #[macro_use] extern crate uucore; -use std::env; use clap::{App, Arg}; +use std::env; #[cfg(target_os = "linux")] pub const _SC_NPROCESSORS_CONF: libc::c_int = 83; @@ -71,7 +71,7 @@ pub fn uumain(args: Vec) -> i32 { None => 0, }; - if ! matches.is_present(OPT_ALL) { + if !matches.is_present(OPT_ALL) { // OMP_NUM_THREADS doesn't have an impact on --all ignore += match env::var("OMP_NUM_THREADS") { Ok(threadstr) => match threadstr.parse() { diff --git a/tests/by-util/test_nproc.rs b/tests/by-util/test_nproc.rs index de3f51de5..055b4890d 100644 --- a/tests/by-util/test_nproc.rs +++ b/tests/by-util/test_nproc.rs @@ -9,7 +9,6 @@ fn test_nproc() { assert!(nproc > 0); } - #[test] fn test_nproc_all_omp() { let (_, mut ucmd) = at_and_ucmd!(); @@ -18,21 +17,19 @@ fn test_nproc_all_omp() { let nproc: u8 = result.stdout.trim().parse().unwrap(); assert!(nproc > 0); - let result = TestScenario::new(util_name!()) - .ucmd_keepenv() - .env("OMP_NUM_THREADS", "1") - .run(); + .ucmd_keepenv() + .env("OMP_NUM_THREADS", "1") + .run(); assert!(result.success); let nproc_omp: u8 = result.stdout.trim().parse().unwrap(); - assert!(nproc-1 == nproc_omp); - + assert!(nproc - 1 == nproc_omp); let result = TestScenario::new(util_name!()) - .ucmd_keepenv() - .env("OMP_NUM_THREADS", "1") // Has no effect - .arg("--all") - .run(); + .ucmd_keepenv() + .env("OMP_NUM_THREADS", "1") // Has no effect + .arg("--all") + .run(); assert!(result.success); let nproc_omp: u8 = result.stdout.trim().parse().unwrap(); assert!(nproc == nproc_omp);