Skip to content

Commit 1cc1e39

Browse files
xtqqczzesylvestre
authored andcommitted
reduce msrv to 1.70
1 parent 3cf6fa1 commit 1cc1e39

8 files changed

Lines changed: 13 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
rust:
11-
- 1.87.0
11+
- 1.70.0
1212
- stable
1313
- nightly
1414
os: [ubuntu-latest, windows-latest, macos-latest]
@@ -30,7 +30,7 @@ jobs:
3030
strategy:
3131
matrix:
3232
rust:
33-
- 1.87.0
33+
- 1.70.0
3434
- stable
3535
- nightly
3636
os: [ubuntu-latest, windows-latest, macos-latest]

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[workspace.package]
22
edition = "2018"
3-
rust-version = "1.87"
3+
rust-version = "1.70"
44

55
[package]
66
name = "num-prime"

src/buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ impl NaiveBuffer {
427427
/// Legendre's phi function, used as a helper function for [`Self::prime_pi`]
428428
pub fn prime_phi(&mut self, x: u64, a: usize, cache: &mut LruCache<(u64, usize), u64>) -> u64 {
429429
if a == 1 {
430-
return x.div_ceil(2);
430+
return (x + 1) / 2;
431431
}
432432
if let Some(v) = cache.get(&(x, a)) {
433433
return *v;

src/factor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ mod tests {
472472
let result = one_line(&n, n * 480, 100);
473473
assert!(result.0.is_some());
474474
let f = result.0.unwrap();
475-
assert!(n.is_multiple_of(f) && f > 1 && f < n);
475+
assert!(n % f == 0 && f > 1 && f < n);
476476
}
477477

478478
// --- trial_division with limit=None (no limit path) ---
@@ -548,7 +548,7 @@ mod tests {
548548
for offset in [1u32, 2, 3, 5, 7] {
549549
let (result, _) = pollard_rho(&target, start, offset, 10000);
550550
if let Some(f) = result {
551-
assert!(target.is_multiple_of(f) && f > 1 && f < target);
551+
assert!(target % f == 0 && f > 1 && f < target);
552552
}
553553
}
554554
}

src/integer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl ExactRoots for BigUint {
115115

116116
// check mod 2
117117
let shift = self.trailing_zeros().unwrap();
118-
if !shift.is_multiple_of(3) {
118+
if shift % 3 != 0 {
119119
return None;
120120
}
121121

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
//! could improve the speed of various functions with the cost of larger memory footprint.
6363
//!
6464
65+
#![allow(clippy::redundant_clone)]
66+
6567
pub mod buffer;
6668
pub mod factor;
6769
pub mod nt_funcs;

src/nt_funcs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ pub(crate) fn factorize64_advanced(cofactors: &[(u64, usize)]) -> Vec<(u64, usiz
347347
i += 1;
348348

349349
// increase max iterations after trying all methods
350-
if i.is_multiple_of(NMETHODS) {
350+
if i % NMETHODS == 0 {
351351
max_iter_ratio *= 2;
352352
}
353353
};
@@ -523,7 +523,7 @@ pub(crate) fn factorize128_advanced(cofactors: &[(u128, usize)]) -> Vec<(u128, u
523523
i += 1;
524524

525525
// increase max iterations after trying all methods
526-
if i.is_multiple_of(NMETHODS) {
526+
if i % NMETHODS == 0 {
527527
max_iter_ratio *= 2;
528528
}
529529
};
@@ -782,7 +782,7 @@ where
782782
pub fn moebius_factorized<T>(factors: &BTreeMap<T, usize>) -> i8 {
783783
if factors.values().any(|exp| exp > &1) {
784784
0
785-
} else if factors.len().is_multiple_of(2) {
785+
} else if factors.len() % 2 == 0 {
786786
1
787787
} else {
788788
-1

0 commit comments

Comments
 (0)