Skip to content

Commit c53c56c

Browse files
committed
chore: update msrv to 1.91.1
1 parent 51139e6 commit c53c56c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+141
-112
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ exclude = [
2424
]
2525

2626
[workspace.package]
27-
rust-version = "1.85"
27+
rust-version = "1.91.1"
2828

2929
[workspace.dependencies]
3030
aligned-vec = { version = "0.6", default-features = false }

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,21 +427,21 @@ clippy_rustdoc: install_rs_check_toolchain
427427
echo "WARNING: skipped clippy_rustdoc, unsupported OS $(OS)"; \
428428
exit 0; \
429429
fi && \
430-
CARGO_TERM_QUIET=true CLIPPYFLAGS="-D warnings" RUSTDOCFLAGS="--no-run --nocapture --test-builder ./scripts/clippy_driver.sh -Z unstable-options" \
430+
CARGO_TERM_QUIET=true CLIPPYFLAGS="-D warnings" RUSTDOCFLAGS="--no-run --test-builder ./scripts/clippy_driver.sh -Z unstable-options" \
431431
cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" test --doc \
432432
--features=boolean,shortint,integer,zk-pok,pbs-stats,strings,experimental \
433-
-p tfhe
433+
-p tfhe -- --nocapture
434434

435435
.PHONY: clippy_rustdoc_gpu # Run clippy lints on doctests enabling the boolean, shortint, integer and zk-pok
436436
clippy_rustdoc_gpu: install_rs_check_toolchain
437437
if [[ "$(OS)" != "Linux" ]]; then \
438438
echo "WARNING: skipped clippy_rustdoc_gpu, unsupported OS $(OS)"; \
439439
exit 0; \
440440
fi && \
441-
CARGO_TERM_QUIET=true CLIPPYFLAGS="-D warnings" RUSTDOCFLAGS="--no-run --nocapture --test-builder ./scripts/clippy_driver.sh -Z unstable-options" \
441+
CARGO_TERM_QUIET=true CLIPPYFLAGS="-D warnings" RUSTDOCFLAGS="--no-run --test-builder ./scripts/clippy_driver.sh -Z unstable-options" \
442442
cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" test --doc \
443443
--features=boolean,shortint,integer,zk-pok,pbs-stats,strings,experimental,gpu \
444-
-p tfhe
444+
-p tfhe -- --nocapture
445445

446446
.PHONY: clippy_c_api # Run clippy lints enabling the boolean, shortint and the C API
447447
clippy_c_api: install_rs_check_toolchain

tfhe-ntt/src/prime.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,18 @@ pub const fn is_prime64(n: u64) -> bool {
8383
// hand-unrolled for the compiler to optimize divisions
8484
#[rustfmt::skip]
8585
{
86-
if n % 2 == 0 { return n == 2; }
87-
if n % 3 == 0 { return n == 3; }
88-
if n % 5 == 0 { return n == 5; }
89-
if n % 7 == 0 { return n == 7; }
90-
if n % 11 == 0 { return n == 11; }
91-
if n % 13 == 0 { return n == 13; }
92-
if n % 17 == 0 { return n == 17; }
93-
if n % 19 == 0 { return n == 19; }
94-
if n % 23 == 0 { return n == 23; }
95-
if n % 29 == 0 { return n == 29; }
96-
if n % 31 == 0 { return n == 31; }
97-
if n % 37 == 0 { return n == 37; }
86+
if n.is_multiple_of(2) { return n == 2; }
87+
if n.is_multiple_of(3) { return n == 3; }
88+
if n.is_multiple_of(5) { return n == 5; }
89+
if n.is_multiple_of(7) { return n == 7; }
90+
if n.is_multiple_of(11) { return n == 11; }
91+
if n.is_multiple_of(13) { return n == 13; }
92+
if n.is_multiple_of(17) { return n == 17; }
93+
if n.is_multiple_of(19) { return n == 19; }
94+
if n.is_multiple_of(23) { return n == 23; }
95+
if n.is_multiple_of(29) { return n == 29; }
96+
if n.is_multiple_of(31) { return n == 31; }
97+
if n.is_multiple_of(37) { return n == 37; }
9898
};
9999

100100
// deterministic miller rabin test, works for any n < 2^64
@@ -104,7 +104,7 @@ pub const fn is_prime64(n: u64) -> bool {
104104
let mut s = 0;
105105
let mut d = n - 1;
106106

107-
while d % 2 == 0 {
107+
while d.is_multiple_of(2) {
108108
s += 1;
109109
d /= 2;
110110
}

tfhe-ntt/src/product.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl Plan {
156156
factors: impl AsRef<[u64]>,
157157
) -> Option<Self> {
158158
fn try_new_impl(polynomial_size: usize, modulus: u64, primes: &mut [u64]) -> Option<Plan> {
159-
if polynomial_size % 2 != 0 {
159+
if !polynomial_size.is_multiple_of(2) {
160160
return None;
161161
}
162162

tfhe-ntt/src/roots.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub const fn get_q_s64(p: Div64) -> (u64, u64) {
77
let p = p.divisor();
88
let mut q = p - 1;
99
let mut s = 0;
10-
while q % 2 == 0 {
10+
while q.is_multiple_of(2) {
1111
q /= 2;
1212
s += 1;
1313
}

tfhe/examples/sha256_bool/padding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
pub fn pad_sha256_input(input: &str) -> Vec<bool> {
99
let bytes = if input.starts_with("0x") && is_valid_hex(&input[2..]) {
1010
let no_prefix = &input[2..];
11-
let hex_input = if no_prefix.len() % 2 == 0 {
11+
let hex_input = if no_prefix.len().is_multiple_of(2) {
1212
// hex value can be converted to bytes
1313
no_prefix.to_string()
1414
} else {

tfhe/src/conformance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl ListSizeConstraint {
6767
if self.group_size == 0 {
6868
size == 0
6969
} else {
70-
size % self.group_size == 0
70+
size.is_multiple_of(self.group_size)
7171
&& size >= self.min_inclusive_group_count * self.group_size
7272
&& size <= self.max_inclusive_group_count * self.group_size
7373
}

tfhe/src/core_crypto/algorithms/polynomial_algorithms.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ pub fn polynomial_wrapping_monic_monomial_div_assign<Scalar, OutputCont>(
400400
OutputCont: ContainerMut<Element = Scalar>,
401401
{
402402
let full_cycles_count = monomial_degree.0 / output.as_ref().container_len();
403-
if full_cycles_count % 2 != 0 {
403+
if !full_cycles_count.is_multiple_of(2) {
404404
output
405405
.as_mut()
406406
.iter_mut()
@@ -425,7 +425,7 @@ pub fn polynomial_wrapping_monic_monomial_div_assign_custom_mod<Scalar, OutputCo
425425
OutputCont: ContainerMut<Element = Scalar>,
426426
{
427427
let full_cycles_count = monomial_degree.0 / output.as_ref().container_len();
428-
if full_cycles_count % 2 != 0 {
428+
if !full_cycles_count.is_multiple_of(2) {
429429
output
430430
.as_mut()
431431
.iter_mut()
@@ -467,7 +467,7 @@ pub fn polynomial_wrapping_monic_monomial_mul_assign<Scalar, OutputCont>(
467467
OutputCont: ContainerMut<Element = Scalar>,
468468
{
469469
let full_cycles_count = monomial_degree.0 / output.as_ref().container_len();
470-
if full_cycles_count % 2 != 0 {
470+
if !full_cycles_count.is_multiple_of(2) {
471471
output
472472
.as_mut()
473473
.iter_mut()
@@ -491,7 +491,7 @@ pub fn polynomial_wrapping_monic_monomial_mul_assign_custom_mod<Scalar, OutputCo
491491
OutputCont: ContainerMut<Element = Scalar>,
492492
{
493493
let full_cycles_count = monomial_degree.0 / output.as_ref().container_len();
494-
if full_cycles_count % 2 != 0 {
494+
if !full_cycles_count.is_multiple_of(2) {
495495
output
496496
.as_mut()
497497
.iter_mut()
@@ -561,7 +561,7 @@ pub fn polynomial_wrapping_monic_monomial_div<Scalar, OutputCont, InputCont>(
561561
let remaining_degree = monomial_degree.0 % polynomial_size;
562562

563563
let full_cycles_count = monomial_degree.0 / polynomial_size;
564-
if full_cycles_count % 2 == 0 {
564+
if full_cycles_count.is_multiple_of(2) {
565565
copy_without_neg(
566566
&mut output[..polynomial_size - remaining_degree],
567567
&input[remaining_degree..],
@@ -625,7 +625,7 @@ pub fn polynomial_wrapping_monic_monomial_mul<Scalar, OutputCont, InputCont>(
625625
let remaining_degree = monomial_degree.0 % polynomial_size;
626626

627627
let full_cycles_count = monomial_degree.0 / polynomial_size;
628-
if full_cycles_count % 2 == 0 {
628+
if full_cycles_count.is_multiple_of(2) {
629629
copy_with_neg(
630630
&mut output[..remaining_degree],
631631
&input[polynomial_size - remaining_degree..],
@@ -701,7 +701,7 @@ pub(crate) fn polynomial_wrapping_monic_monomial_mul_and_subtract<Scalar, Output
701701
let remaining_degree = monomial_degree.0 % polynomial_size;
702702

703703
let full_cycles_count = monomial_degree.0 / polynomial_size;
704-
if full_cycles_count % 2 == 0 {
704+
if full_cycles_count.is_multiple_of(2) {
705705
copy_with_neg_and_subtract(
706706
&mut output[..remaining_degree],
707707
&input[polynomial_size - remaining_degree..],

tfhe/src/core_crypto/algorithms/test/lwe_multi_bit_bootstrap_key_generation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn test_parallel_and_seeded_multi_bit_bsk_gen_equivalence<
4646
let noise_distribution =
4747
DynamicDistribution::new_gaussian_from_std_dev(StandardDev::from_standard_dev(10.));
4848

49-
while lwe_dim.0 % grouping_factor.0 != 0 {
49+
while !lwe_dim.0.is_multiple_of(grouping_factor.0) {
5050
lwe_dim = LweDimension(lwe_dim.0 + 1);
5151
}
5252

tfhe/src/core_crypto/commons/traits/contiguous_entity_container.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ pub trait ContiguousEntityContainer: AsRef<[Self::Element]> {
233233
) -> ChunksExactWrappingLendingIterator<'_, Self::Element, Self::SelfView<'_>> {
234234
let entity_count = self.entity_count();
235235
assert!(
236-
entity_count % chunk_size == 0,
236+
entity_count.is_multiple_of(chunk_size),
237237
"The current container has {entity_count} entities, which is not dividable by the \
238238
requested chunk_size: {chunk_size}, preventing chunks_exact from returning an iterator."
239239
);
@@ -297,7 +297,7 @@ pub trait ContiguousEntityContainer: AsRef<[Self::Element]> {
297297
{
298298
let entity_count = self.entity_count();
299299
assert!(
300-
entity_count % chunk_size == 0,
300+
entity_count.is_multiple_of(chunk_size),
301301
"The current container has {entity_count} entities, which is not dividable by the \
302302
requested chunk_size: {chunk_size}, preventing chunks_exact from returning an iterator."
303303
);
@@ -435,7 +435,7 @@ pub trait ContiguousEntityContainerMut: ContiguousEntityContainer + AsMut<[Self:
435435
) -> ChunksExactWrappingLendingIteratorMut<'_, Self::Element, Self::SelfMutView<'_>> {
436436
let entity_count = self.entity_count();
437437
assert!(
438-
entity_count % chunk_size == 0,
438+
entity_count.is_multiple_of(chunk_size),
439439
"The current container has {entity_count} entities, which is not dividable by the \
440440
requested chunk_size: {chunk_size}, preventing chunks_exact_mut from returning an \
441441
iterator."
@@ -515,7 +515,7 @@ pub trait ContiguousEntityContainerMut: ContiguousEntityContainer + AsMut<[Self:
515515
{
516516
let entity_count = self.entity_count();
517517
assert!(
518-
entity_count % chunk_size == 0,
518+
entity_count.is_multiple_of(chunk_size),
519519
"The current container has {entity_count} entities, which is not dividable by the \
520520
requested chunk_size: {chunk_size}, preventing chunks_exact from returning an iterator."
521521
);

0 commit comments

Comments
 (0)