mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
rustfmt the recent change
This commit is contained in:
parent
6693018631
commit
d2913f8080
4 changed files with 18 additions and 12 deletions
|
@ -125,7 +125,7 @@ fn _factor<A: Arithmetic + miller_rabin::Basis>(num: u64, f: Factors) -> Factors
|
||||||
let n = A::new(num);
|
let n = A::new(num);
|
||||||
let divisor = match miller_rabin::test::<A>(n) {
|
let divisor = match miller_rabin::test::<A>(n) {
|
||||||
Prime => {
|
Prime => {
|
||||||
#[cfg(feature="coz")]
|
#[cfg(feature = "coz")]
|
||||||
coz::progress!("factor found");
|
coz::progress!("factor found");
|
||||||
let mut r = f;
|
let mut r = f;
|
||||||
r.push(num);
|
r.push(num);
|
||||||
|
@ -141,7 +141,7 @@ fn _factor<A: Arithmetic + miller_rabin::Basis>(num: u64, f: Factors) -> Factors
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn factor(mut n: u64) -> Factors {
|
pub fn factor(mut n: u64) -> Factors {
|
||||||
#[cfg(feature="coz")]
|
#[cfg(feature = "coz")]
|
||||||
coz::begin!("factorization");
|
coz::begin!("factorization");
|
||||||
let mut factors = Factors::one();
|
let mut factors = Factors::one();
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ pub fn factor(mut n: u64) -> Factors {
|
||||||
}
|
}
|
||||||
|
|
||||||
if n == 1 {
|
if n == 1 {
|
||||||
#[cfg(feature="coz")]
|
#[cfg(feature = "coz")]
|
||||||
coz::end!("factorization");
|
coz::end!("factorization");
|
||||||
return factors;
|
return factors;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ pub fn factor(mut n: u64) -> Factors {
|
||||||
_factor::<Montgomery<u64>>(n, factors)
|
_factor::<Montgomery<u64>>(n, factors)
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature="coz")]
|
#[cfg(feature = "coz")]
|
||||||
coz::end!("factorization");
|
coz::end!("factorization");
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub(crate) fn factor(mut num: u64, mut factors: Factors) -> (Factors, u64) {
|
||||||
if x <= ceil {
|
if x <= ceil {
|
||||||
num = x;
|
num = x;
|
||||||
k += 1;
|
k += 1;
|
||||||
#[cfg(feature="coz")]
|
#[cfg(feature = "coz")]
|
||||||
coz::progress!("factor found");
|
coz::progress!("factor found");
|
||||||
} else {
|
} else {
|
||||||
if k > 0 {
|
if k > 0 {
|
||||||
|
|
|
@ -224,8 +224,14 @@ fn test_size_and_reference() {
|
||||||
let mut file1 = at.make_file(TFILE1);
|
let mut file1 = at.make_file(TFILE1);
|
||||||
let mut file2 = at.make_file(TFILE2);
|
let mut file2 = at.make_file(TFILE2);
|
||||||
file1.write_all(b"1234567890").unwrap();
|
file1.write_all(b"1234567890").unwrap();
|
||||||
ucmd.args(&["--reference", TFILE1, "--size", "+5", TFILE2]).succeeds();
|
ucmd.args(&["--reference", TFILE1, "--size", "+5", TFILE2])
|
||||||
|
.succeeds();
|
||||||
file2.seek(SeekFrom::End(0)).unwrap();
|
file2.seek(SeekFrom::End(0)).unwrap();
|
||||||
let actual = file2.seek(SeekFrom::Current(0)).unwrap();
|
let actual = file2.seek(SeekFrom::Current(0)).unwrap();
|
||||||
assert!(expected == actual, "expected '{}' got '{}'", expected, actual);
|
assert!(
|
||||||
|
expected == actual,
|
||||||
|
"expected '{}' got '{}'",
|
||||||
|
expected,
|
||||||
|
actual
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue