chore(ci): toolchain update

This commit is contained in:
Arthur Meyre
2024-11-29 18:35:05 +01:00
parent 1151bb267e
commit 33131c664a
36 changed files with 103 additions and 97 deletions

View File

@@ -101,7 +101,7 @@ pub fn check_tfhe_docs_are_tested() -> Result<(), Error> {
.into_iter()
.filter_map(|entry| {
let path = entry.path().canonicalize().ok()?;
if path.is_file() && path.extension().map_or(false, |e| e == "md") {
if path.is_file() && path.extension().is_some_and(|e| e == "md") {
let file_content = std::fs::read_to_string(&path).ok()?;
if file_content.contains("```rust") {
Some(path.to_path_buf())

View File

@@ -990,7 +990,7 @@ impl Plan {
base_n: usize,
}
impl<'de, 'a> Visitor<'de> for SeqVisitor<'a> {
impl<'de> Visitor<'de> for SeqVisitor<'_> {
type Value = ();
fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {

View File

@@ -126,6 +126,7 @@ impl BooleanKeySwitchingParameters {
/// Parameter sets given in TFHE-lib:
/// <https://github.com/tfhe/tfhe/blob/bc71bfae7ad9d5f8ce5f29bdfd691189bfe207f3/src/libtfhe/tfhe_gate_bootstrapping.cpp#L51>
///
/// Original security in 2020 was 129-bits, while it is currently around 120 bits.
pub const TFHE_LIB_PARAMETERS: BooleanParameters = BooleanParameters {
lwe_dimension: LweDimension(630),

View File

@@ -77,10 +77,9 @@ pub struct StandardMultiBitModulusSwitchedCt<
}
impl<
'a,
Scalar: UnsignedInteger + CastInto<usize> + CastFrom<usize>,
C: Container<Element = Scalar> + Sync,
> MultiBitModulusSwitchedCt for StandardMultiBitModulusSwitchedCt<'a, Scalar, C>
> MultiBitModulusSwitchedCt for StandardMultiBitModulusSwitchedCt<'_, Scalar, C>
{
fn lwe_dimension(&self) -> LweDimension {
self.input.lwe_size().to_lwe_dimension()

View File

@@ -263,7 +263,7 @@ pub fn fill_with_forward_fourier_scratch(fft: FftView<'_>) -> Result<StackReq, S
fft.forward_scratch()
}
impl<'a> PseudoFourierGgswCiphertextMutView<'a> {
impl PseudoFourierGgswCiphertextMutView<'_> {
/// Fill a GGSW ciphertext with the Fourier transform of a GGSW ciphertext in the standard
/// domain.
pub fn fill_with_forward_fourier<

View File

@@ -346,7 +346,7 @@ fn convert_backward_torus<Scalar: UnsignedTorus>(
}
}
impl<'a> Fft128View<'a> {
impl Fft128View<'_> {
pub fn polynomial_size(self) -> PolynomialSize {
PolynomialSize(2 * self.plan.fft_size())
}

View File

@@ -1218,7 +1218,7 @@ pub fn convert_add_backward_torus(
);
}
impl<'a> Fft128View<'a> {
impl Fft128View<'_> {
pub fn forward_as_integer_split(
self,
fourier_re0: &mut [f64],

View File

@@ -184,7 +184,7 @@ pub fn fill_with_forward_fourier_scratch(fft: FftView<'_>) -> Result<StackReq, S
fft.forward_scratch()
}
impl<'a> FourierLweBootstrapKeyMutView<'a> {
impl FourierLweBootstrapKeyMutView<'_> {
/// Fill a bootstrapping key with the Fourier transform of a bootstrapping key in the standard
/// domain.
pub fn fill_with_forward_fourier<Scalar: UnsignedTorus>(
@@ -281,7 +281,7 @@ pub fn batch_bootstrap_scratch<Scalar>(
)?)
}
impl<'a> FourierLweBootstrapKeyView<'a> {
impl FourierLweBootstrapKeyView<'_> {
// CastInto required for PBS modulus switch which returns a usize
pub fn blind_rotate_assign<InputScalar, OutputScalar>(
self,

View File

@@ -250,7 +250,7 @@ pub fn fill_with_forward_fourier_scratch(fft: FftView<'_>) -> Result<StackReq, S
fft.forward_scratch()
}
impl<'a> FourierGgswCiphertextMutView<'a> {
impl FourierGgswCiphertextMutView<'_> {
/// Fill a GGSW ciphertext with the Fourier transform of a GGSW ciphertext in the standard
/// domain.
pub fn fill_with_forward_fourier<Scalar: UnsignedTorus>(

View File

@@ -46,6 +46,11 @@ impl<'buffers, Scalar: UnsignedInteger> TensorSignedDecompositionLendingIter<'bu
// inlining this improves perf of external product by about 25%, even in LTO builds
#[inline]
#[allow(
clippy::type_complexity,
reason = "The type complexity would require a pub type = ...; \
but impl Trait is not stable in pub type so we tell clippy to leave us alone"
)]
pub fn next_term<'short>(
&'short mut self,
) -> Option<(

View File

@@ -329,7 +329,7 @@ fn convert_add_backward_torus<Scalar: UnsignedTorus>(
convert_add_backward_torus_scalar::<Scalar>(out_re, out_im, inp, twisties);
}
impl<'a> FftView<'a> {
impl FftView<'_> {
/// Return the polynomial size that this FFT was made for.
pub fn polynomial_size(self) -> PolynomialSize {
PolynomialSize(2 * self.plan.fft_size())
@@ -629,7 +629,7 @@ impl<C: Container<Element = c64>> serde::Serialize for FourierPolynomialList<C>
buf: &'a [c64],
}
impl<'a> serde::Serialize for SingleFourierPolynomial<'a> {
impl serde::Serialize for SingleFourierPolynomial<'_> {
fn serialize<S: serde::Serializer>(
&self,
serializer: S,
@@ -701,7 +701,7 @@ impl<'de, C: IntoContainerOwned<Element = c64>> serde::Deserialize<'de>
buf: &'a mut [c64],
}
impl<'de, 'a> serde::de::DeserializeSeed<'de> for FillFourier<'a> {
impl<'de> serde::de::DeserializeSeed<'de> for FillFourier<'_> {
type Value = ();
fn deserialize<D: serde::Deserializer<'de>>(

View File

@@ -23,7 +23,7 @@ pub struct CudaSliceMut<'a, T: Numeric> {
_phantom_2: PhantomData<&'a mut ()>,
}
impl<'a, T> CudaSlice<'a, T>
impl<T> CudaSlice<'_, T>
where
T: Numeric,
{
@@ -53,7 +53,7 @@ where
}
}
impl<'a, T> CudaSliceMut<'a, T>
impl<T> CudaSliceMut<'_, T>
where
T: Numeric,
{

View File

@@ -36,7 +36,7 @@ impl ArrayBackend for CpuFheBoolArrayBackend {
type Owned = Vec<BooleanBlock>;
}
impl<'a> BackendDataContainer for &'a [BooleanBlock] {
impl BackendDataContainer for &[BooleanBlock] {
type Backend = CpuFheBoolArrayBackend;
fn len(&self) -> usize {
@@ -55,7 +55,7 @@ impl<'a> BackendDataContainer for &'a [BooleanBlock] {
}
}
impl<'a> BackendDataContainer for &'a mut [BooleanBlock] {
impl BackendDataContainer for &mut [BooleanBlock] {
type Backend = CpuFheBoolArrayBackend;
fn len(&self) -> usize {
@@ -74,7 +74,7 @@ impl<'a> BackendDataContainer for &'a mut [BooleanBlock] {
}
}
impl<'a> BackendDataContainerMut for &'a mut [BooleanBlock] {
impl BackendDataContainerMut for &mut [BooleanBlock] {
fn as_sub_slice_mut(
&mut self,
range: impl RangeBounds<usize>,
@@ -220,7 +220,7 @@ impl FheTryEncrypt<&[bool], ClientKey> for CpuFheBoolArray {
}
}
impl<'a> FheDecrypt<Vec<bool>> for CpuFheBoolSlice<'a> {
impl FheDecrypt<Vec<bool>> for CpuFheBoolSlice<'_> {
fn decrypt(&self, key: &ClientKey) -> Vec<bool> {
self.elems
.iter()
@@ -229,7 +229,7 @@ impl<'a> FheDecrypt<Vec<bool>> for CpuFheBoolSlice<'a> {
}
}
impl<'a> FheDecrypt<Vec<bool>> for CpuFheBoolSliceMut<'a> {
impl FheDecrypt<Vec<bool>> for CpuFheBoolSliceMut<'_> {
fn decrypt(&self, key: &ClientKey) -> Vec<bool> {
self.as_slice().decrypt(key)
}

View File

@@ -367,7 +367,7 @@ where
}
}
impl<'a, T> BackendDataContainer for &'a [T]
impl<T> BackendDataContainer for &[T]
where
T: IntegerRadixCiphertext,
{
@@ -389,7 +389,7 @@ where
}
}
impl<'a, T> BackendDataContainer for &'a mut [T]
impl<T> BackendDataContainer for &mut [T]
where
T: IntegerRadixCiphertext,
{
@@ -411,7 +411,7 @@ where
}
}
impl<'a, T> BackendDataContainerMut for &'a mut [T]
impl<T> BackendDataContainerMut for &mut [T]
where
T: IntegerRadixCiphertext,
{
@@ -481,7 +481,7 @@ where
}
}
impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheUintSliceMut<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheUintSliceMut<'_, Id>
where
Id: FheUintId,
Clear: RecomposableFrom<u64> + UnsignedNumeric,
@@ -491,7 +491,7 @@ where
}
}
impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheUintSlice<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheUintSlice<'_, Id>
where
Id: FheUintId,
Clear: RecomposableFrom<u64> + UnsignedNumeric,
@@ -534,7 +534,7 @@ where
}
}
impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheIntSliceMut<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheIntSliceMut<'_, Id>
where
Id: FheIntId,
Clear: RecomposableSignedInteger,
@@ -544,7 +544,7 @@ where
}
}
impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheIntSlice<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheIntSlice<'_, Id>
where
Id: FheIntId,
Clear: RecomposableSignedInteger,

View File

@@ -57,7 +57,7 @@ where
type Owned = ClearContainer<Vec<T>>;
}
impl<'a, T> BackendDataContainer for ClearContainer<&'a [T]>
impl<T> BackendDataContainer for ClearContainer<&'_ [T]>
where
T: Copy,
{
@@ -79,7 +79,7 @@ where
}
}
impl<'a, T> BackendDataContainer for ClearContainer<&'a mut [T]>
impl<T> BackendDataContainer for ClearContainer<&mut [T]>
where
T: Copy,
{
@@ -101,7 +101,7 @@ where
}
}
impl<'a, T> BackendDataContainerMut for ClearContainer<&'a mut [T]>
impl<T> BackendDataContainerMut for ClearContainer<&mut [T]>
where
T: Copy,
{

View File

@@ -229,7 +229,7 @@ pub enum InnerBoolSlice<'a> {
Cpu(&'a [BooleanBlock]),
}
impl<'a> InnerBoolSlice<'a> {
impl InnerBoolSlice<'_> {
fn on_cpu(&self) -> Cow<'_, [BooleanBlock]> {
match self {
InnerBoolSlice::Cpu(cpu_slice) => Cow::Borrowed(cpu_slice),
@@ -237,7 +237,7 @@ impl<'a> InnerBoolSlice<'a> {
}
}
impl<'a> BackendDataContainer for InnerBoolSlice<'a> {
impl BackendDataContainer for InnerBoolSlice<'_> {
type Backend = DynFheBoolArrayBackend;
fn len(&self) -> usize {
@@ -268,7 +268,7 @@ pub enum InnerBoolSliceMut<'a> {
Cpu(&'a mut [BooleanBlock]),
}
impl<'a> BackendDataContainer for InnerBoolSliceMut<'a> {
impl BackendDataContainer for InnerBoolSliceMut<'_> {
type Backend = DynFheBoolArrayBackend;
fn len(&self) -> usize {
@@ -295,7 +295,7 @@ impl<'a> BackendDataContainer for InnerBoolSliceMut<'a> {
}
}
impl<'a> BackendDataContainerMut for InnerBoolSliceMut<'a> {
impl BackendDataContainerMut for InnerBoolSliceMut<'_> {
fn as_sub_slice_mut(
&mut self,
range: impl RangeBounds<usize>,

View File

@@ -74,7 +74,7 @@ pub enum InnerIntSlice<'a> {
Cpu(&'a [SignedRadixCiphertext]),
}
impl<'a> InnerIntSlice<'a> {
impl InnerIntSlice<'_> {
pub(crate) fn on_cpu(&self) -> Cow<'_, [SignedRadixCiphertext]> {
match self {
Self::Cpu(cpu_slice) => Cow::Borrowed(cpu_slice),
@@ -82,7 +82,7 @@ impl<'a> InnerIntSlice<'a> {
}
}
impl<'a> BackendDataContainer for InnerIntSlice<'a> {
impl BackendDataContainer for InnerIntSlice<'_> {
type Backend = DynIntBackend;
fn len(&self) -> usize {
@@ -111,7 +111,7 @@ pub enum InnerIntSliceMut<'a> {
Cpu(&'a mut [SignedRadixCiphertext]),
}
impl<'a> BackendDataContainer for InnerIntSliceMut<'a> {
impl BackendDataContainer for InnerIntSliceMut<'_> {
type Backend = DynIntBackend;
fn len(&self) -> usize {
@@ -136,7 +136,7 @@ impl<'a> BackendDataContainer for InnerIntSliceMut<'a> {
}
}
impl<'a> BackendDataContainerMut for InnerIntSliceMut<'a> {
impl BackendDataContainerMut for InnerIntSliceMut<'_> {
fn as_sub_slice_mut(&mut self, range: impl RangeBounds<usize>) -> InnerIntSliceMut<'_> {
match self {
Self::Cpu(cpu_slice) => {

View File

@@ -36,7 +36,7 @@ pub enum InnerUintSlice<'a> {
Cpu(&'a [RadixCiphertext]),
}
impl<'a> InnerUintSlice<'a> {
impl InnerUintSlice<'_> {
pub(crate) fn on_cpu(&self) -> Cow<'_, [RadixCiphertext]> {
match self {
InnerUintSlice::Cpu(cpu_slice) => Cow::Borrowed(cpu_slice),
@@ -98,7 +98,7 @@ impl BackendDataContainerMut for InnerUintArray {
}
}
impl<'a> BackendDataContainer for InnerUintSlice<'a> {
impl BackendDataContainer for InnerUintSlice<'_> {
type Backend = DynUintBackend;
fn len(&self) -> usize {
@@ -123,7 +123,7 @@ impl<'a> BackendDataContainer for InnerUintSlice<'a> {
}
}
impl<'a> BackendDataContainer for InnerUintSliceMut<'a> {
impl BackendDataContainer for InnerUintSliceMut<'_> {
type Backend = DynUintBackend;
fn len(&self) -> usize {
@@ -148,7 +148,7 @@ impl<'a> BackendDataContainer for InnerUintSliceMut<'a> {
}
}
impl<'a> BackendDataContainerMut for InnerUintSliceMut<'a> {
impl BackendDataContainerMut for InnerUintSliceMut<'_> {
fn as_sub_slice_mut(&mut self, range: impl RangeBounds<usize>) -> InnerUintSliceMut<'_> {
match self {
Self::Cpu(cpu_slice) => {
@@ -403,7 +403,7 @@ where
}
}
impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for FheUintSliceMut<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for FheUintSliceMut<'_, Id>
where
Id: FheUintId,
Clear: RecomposableFrom<u64> + UnsignedNumeric,
@@ -413,7 +413,7 @@ where
}
}
impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for FheUintSlice<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for FheUintSlice<'_, Id>
where
Id: FheUintId,
Clear: RecomposableFrom<u64> + UnsignedNumeric,

View File

@@ -68,7 +68,7 @@ impl From<Vec<CudaBooleanBlock>> for GpuBooleanOwned {
}
}
impl<'a> BackendDataContainer for GpuBooleanSlice<'a> {
impl BackendDataContainer for GpuBooleanSlice<'_> {
type Backend = GpuFheBoolArrayBackend;
fn len(&self) -> usize {
@@ -89,7 +89,7 @@ impl<'a> BackendDataContainer for GpuBooleanSlice<'a> {
}
}
impl<'a> BackendDataContainer for GpuBooleanSliceMut<'a> {
impl BackendDataContainer for GpuBooleanSliceMut<'_> {
type Backend = GpuFheBoolArrayBackend;
fn len(&self) -> usize {
@@ -110,7 +110,7 @@ impl<'a> BackendDataContainer for GpuBooleanSliceMut<'a> {
}
}
impl<'a> BackendDataContainerMut for GpuBooleanSliceMut<'a> {
impl BackendDataContainerMut for GpuBooleanSliceMut<'_> {
fn as_sub_slice_mut(
&mut self,
range: impl RangeBounds<usize>,
@@ -271,7 +271,7 @@ impl FheTryEncrypt<&[bool], ClientKey> for GpuFheBoolArray {
}
}
impl<'a> FheDecrypt<Vec<bool>> for GpuFheBoolSlice<'a> {
impl FheDecrypt<Vec<bool>> for GpuFheBoolSlice<'_> {
fn decrypt(&self, key: &ClientKey) -> Vec<bool> {
with_thread_local_cuda_streams(|streams| {
self.elems
@@ -287,7 +287,7 @@ impl<'a> FheDecrypt<Vec<bool>> for GpuFheBoolSlice<'a> {
}
}
impl<'a> FheDecrypt<Vec<bool>> for GpuFheBoolSliceMut<'a> {
impl FheDecrypt<Vec<bool>> for GpuFheBoolSliceMut<'_> {
fn decrypt(&self, key: &ClientKey) -> Vec<bool> {
self.as_slice().decrypt(key)
}

View File

@@ -420,7 +420,7 @@ where
}
}
impl<'a, T> BackendDataContainer for GpuSlice<'a, T>
impl<T> BackendDataContainer for GpuSlice<'_, T>
where
T: CudaIntegerRadixCiphertext,
{
@@ -444,7 +444,7 @@ where
}
}
impl<'a, T> BackendDataContainer for GpuSliceMut<'a, T>
impl<T> BackendDataContainer for GpuSliceMut<'_, T>
where
T: CudaIntegerRadixCiphertext,
{
@@ -468,7 +468,7 @@ where
}
}
impl<'a, T> BackendDataContainerMut for GpuSliceMut<'a, T>
impl<T> BackendDataContainerMut for GpuSliceMut<'_, T>
where
T: CudaIntegerRadixCiphertext,
{
@@ -553,7 +553,7 @@ where
}
}
impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for GpuFheUintSliceMut<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for GpuFheUintSliceMut<'_, Id>
where
Id: FheUintId,
Clear: RecomposableFrom<u64> + UnsignedNumeric,
@@ -563,7 +563,7 @@ where
}
}
impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for GpuFheUintSlice<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for GpuFheUintSlice<'_, Id>
where
Id: FheUintId,
Clear: RecomposableFrom<u64> + UnsignedNumeric,
@@ -617,7 +617,7 @@ where
}
}
impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for GpuFheIntSliceMut<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for GpuFheIntSliceMut<'_, Id>
where
Id: FheIntId,
Clear: RecomposableSignedInteger,
@@ -627,7 +627,7 @@ where
}
}
impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for GpuFheIntSlice<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for GpuFheIntSlice<'_, Id>
where
Id: FheIntId,
Clear: RecomposableSignedInteger,

View File

@@ -111,9 +111,8 @@ where
}
}
impl<'a, 's, C1, Id> Not for &'a FheArrayBase<C1, Id>
impl<C1, Id> Not for &FheArrayBase<C1, Id>
where
'a: 's,
Id: Default,
C1: BackendDataContainer,
C1::Backend: BitwiseArrayBackend,

View File

@@ -194,13 +194,13 @@ impl<'a, T> Iterator for StridedIter<'a, T> {
}
}
impl<'a, T> ExactSizeIterator for StridedIter<'a, T> {
impl<T> ExactSizeIterator for StridedIter<'_, T> {
fn len(&self) -> usize {
self.index_producer.len()
}
}
impl<'a, T> DoubleEndedIterator for StridedIter<'a, T> {
impl<T> DoubleEndedIterator for StridedIter<'_, T> {
fn next_back(&mut self) -> Option<Self::Item> {
let current_flat_index = self.index_producer.next_back()?;
self.data.get(current_flat_index)
@@ -240,13 +240,13 @@ impl<'a, T> Iterator for CountedStridedIter<'a, T> {
}
}
impl<'a, T> ExactSizeIterator for CountedStridedIter<'a, T> {
impl<T> ExactSizeIterator for CountedStridedIter<'_, T> {
fn len(&self) -> usize {
self.max_count - self.current_count
}
}
impl<'a, T> DoubleEndedIterator for CountedStridedIter<'a, T> {
impl<T> DoubleEndedIterator for CountedStridedIter<'_, T> {
fn next_back(&mut self) -> Option<Self::Item> {
if self.current_count == 0 {
None
@@ -290,7 +290,7 @@ where
}
}
impl<'a, T> rayon::iter::IndexedParallelIterator for ParStridedIter<'a, T>
impl<T> rayon::iter::IndexedParallelIterator for ParStridedIter<'_, T>
where
T: Send + Sync,
{
@@ -407,7 +407,7 @@ impl<'a, T> Iterator for OffsettedStridedIterMut<'a, T> {
}
}
impl<'a, T> DoubleEndedIterator for OffsettedStridedIterMut<'a, T> {
impl<T> DoubleEndedIterator for OffsettedStridedIterMut<'_, T> {
fn next_back(&mut self) -> Option<Self::Item> {
if self.current_count == 0 {
None
@@ -427,7 +427,7 @@ impl<'a, T> DoubleEndedIterator for OffsettedStridedIterMut<'a, T> {
}
}
impl<'a, T> ExactSizeIterator for OffsettedStridedIterMut<'a, T> {
impl<T> ExactSizeIterator for OffsettedStridedIterMut<'_, T> {
fn len(&self) -> usize {
ExactSizeIterator::len(&self.index_producer)
}
@@ -466,7 +466,7 @@ where
}
}
impl<'a, T> rayon::iter::IndexedParallelIterator for ParStridedIterMut<'a, T>
impl<T> rayon::iter::IndexedParallelIterator for ParStridedIterMut<'_, T>
where
T: Send,
{

View File

@@ -7,7 +7,7 @@ pub(crate) enum MaybeCloned<'a, T> {
Cloned(T),
}
impl<'a, T> MaybeCloned<'a, T> {
impl<T> MaybeCloned<'_, T> {
pub(crate) fn into_owned(self) -> T
where
T: ToOwned<Owned = T>,

View File

@@ -203,7 +203,7 @@ impl serde::Serialize for SmallVec {
struct SmallVecVisitor;
impl<'de> serde::de::Visitor<'de> for SmallVecVisitor {
impl serde::de::Visitor<'_> for SmallVecVisitor {
type Value = SmallVec;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {

View File

@@ -129,9 +129,9 @@ impl ParameterSetConformant for CompressedModulusSwitchedRadixCiphertextGeneric
.all(|block| block.is_conformant(&shortint_params));
let last_item_ok = if params.num_blocks_per_integer % 2 == 1 {
last_block.as_ref().map_or(false, |last_block| {
last_block.is_conformant(&params.shortint_params)
})
last_block
.as_ref()
.is_some_and(|last_block| last_block.is_conformant(&params.shortint_params))
} else {
true
};

View File

@@ -41,7 +41,7 @@ impl CudaServerKey {
let sign_bit_pos = self.message_modulus.0.ilog2() - 1;
let sign_bit_is_set = scalar_blocks
.get(ct_len.0 - 1)
.map_or(false, |block| (block >> sign_bit_pos) == 1);
.is_some_and(|block| (block >> sign_bit_pos) == 1);
if scalar > Scalar::ZERO
&& (scalar_blocks.len() > ct_len.0
@@ -72,7 +72,7 @@ impl CudaServerKey {
let sign_bit_pos = self.message_modulus.0.ilog2() - 1;
let sign_bit_is_unset = scalar_blocks
.get(ct_len.0 - 1)
.map_or(false, |block| (block >> sign_bit_pos) == 0);
.is_some_and(|block| (block >> sign_bit_pos) == 0);
if at_least_one_block_is_not_full_of_1s || sign_bit_is_unset {
// Scalar is smaller than lowest value of T

View File

@@ -74,7 +74,7 @@ pub struct KeySwitchingKey {
pub(crate) key: crate::shortint::KeySwitchingKey,
}
impl<'keys> From<KeySwitchingKeyBuildHelper<'keys>> for KeySwitchingKey {
impl From<KeySwitchingKeyBuildHelper<'_>> for KeySwitchingKey {
fn from(value: KeySwitchingKeyBuildHelper) -> Self {
Self {
key: value.build_helper.into(),
@@ -82,7 +82,7 @@ impl<'keys> From<KeySwitchingKeyBuildHelper<'keys>> for KeySwitchingKey {
}
}
impl<'keys> From<KeySwitchingKeyBuildHelper<'keys>> for KeySwitchingKeyMaterial {
impl From<KeySwitchingKeyBuildHelper<'_>> for KeySwitchingKeyMaterial {
fn from(value: KeySwitchingKeyBuildHelper) -> Self {
Self {
material: value.build_helper.key_switching_key_material,
@@ -231,7 +231,7 @@ pub struct CompressedKeySwitchingKey {
pub(crate) key: crate::shortint::CompressedKeySwitchingKey,
}
impl<'keys> From<CompressedKeySwitchingKeyBuildHelper<'keys>> for CompressedKeySwitchingKey {
impl From<CompressedKeySwitchingKeyBuildHelper<'_>> for CompressedKeySwitchingKey {
fn from(value: CompressedKeySwitchingKeyBuildHelper) -> Self {
Self {
key: value.build_helper.into(),
@@ -239,9 +239,7 @@ impl<'keys> From<CompressedKeySwitchingKeyBuildHelper<'keys>> for CompressedKeyS
}
}
impl<'keys> From<CompressedKeySwitchingKeyBuildHelper<'keys>>
for CompressedKeySwitchingKeyMaterial
{
impl From<CompressedKeySwitchingKeyBuildHelper<'_>> for CompressedKeySwitchingKeyMaterial {
fn from(value: CompressedKeySwitchingKeyBuildHelper) -> Self {
Self {
material: value.build_helper.key_switching_key_material,

View File

@@ -18,7 +18,7 @@ pub(crate) struct BitExtractor<'a> {
buffer: VecDeque<Ciphertext>,
}
impl<'a> Iterator for BitExtractor<'a> {
impl Iterator for BitExtractor<'_> {
type Item = Ciphertext;
fn next(&mut self) -> Option<Self::Item> {

View File

@@ -38,7 +38,7 @@ impl ServerKey {
let sign_bit_pos = self.key.message_modulus.0.ilog2() - 1;
let sign_bit_is_set = scalar_blocks
.get(ct.blocks().len() - 1)
.map_or(false, |block| (block >> sign_bit_pos) == 1);
.is_some_and(|block| (block >> sign_bit_pos) == 1);
if scalar > Scalar::ZERO
&& (scalar_blocks.len() > ct.blocks().len()
@@ -69,7 +69,7 @@ impl ServerKey {
let sign_bit_pos = self.key.message_modulus.0.ilog2() - 1;
let sign_bit_is_unset = scalar_blocks
.get(ct.blocks().len() - 1)
.map_or(false, |block| (block >> sign_bit_pos) == 0);
.is_some_and(|block| (block >> sign_bit_pos) == 0);
if at_least_one_block_is_not_full_of_1s || sign_bit_is_unset {
// Scalar is smaller than lowest value of T

View File

@@ -87,7 +87,7 @@ pub mod utils {
if path_buf.exists() {
let file = File::open(&path_buf).unwrap();
// Lock for reading
file.lock_shared().unwrap();
fs2::FileExt::lock_shared(&file).unwrap();
let file_reader = BufReader::new(file);
bincode::deserialize_from::<_, (P, K)>(file_reader)
.ok()

View File

@@ -7,8 +7,14 @@
#![doc(test(attr(warn(unused))))]
#![doc(test(attr(allow(unused_variables))))]
#![doc(test(attr(allow(unused_imports))))]
// Enable all warnings first as it may break the "allow" priority/activation as some lints gets
// moved around in clippy categories
// Enable pedantic lints
#![warn(clippy::pedantic)]
// Nursery lints
#![warn(clippy::nursery)]
#![warn(rustdoc::broken_intra_doc_links)]
// The following lints have been temporarily allowed
// They are expected to be fixed progressively
#![allow(clippy::unreadable_literal)] // 830
@@ -50,8 +56,6 @@
#![allow(clippy::explicit_iter_loop)]
// End allowed pedantic lints
// Nursery lints
#![warn(clippy::nursery)]
// The following lints have been temporarily allowed
// They are expected to be fixed progressively
#![allow(clippy::missing_const_for_fn)] // 243
@@ -71,8 +75,8 @@
)]
#![cfg_attr(all(doc, not(doctest)), feature(doc_auto_cfg))]
#![cfg_attr(all(doc, not(doctest)), feature(doc_cfg))]
#![warn(rustdoc::broken_intra_doc_links)]
extern crate core;
// Weird clippy lint triggering without any code location
#![cfg_attr(test, allow(clippy::large_stack_arrays))]
#[cfg(feature = "__c_api")]
pub mod c_api;

View File

@@ -87,7 +87,7 @@ pub struct KeySwitchingKey {
pub(crate) src_server_key: Option<ServerKey>,
}
impl<'keys> From<KeySwitchingKeyBuildHelper<'keys>> for KeySwitchingKey {
impl From<KeySwitchingKeyBuildHelper<'_>> for KeySwitchingKey {
fn from(value: KeySwitchingKeyBuildHelper) -> Self {
let KeySwitchingKeyBuildHelper {
key_switching_key_material,
@@ -816,7 +816,7 @@ pub struct CompressedKeySwitchingKey {
pub(crate) src_server_key: Option<CompressedServerKey>,
}
impl<'keys> From<CompressedKeySwitchingKeyBuildHelper<'keys>> for CompressedKeySwitchingKey {
impl From<CompressedKeySwitchingKeyBuildHelper<'_>> for CompressedKeySwitchingKey {
fn from(value: CompressedKeySwitchingKeyBuildHelper) -> Self {
let CompressedKeySwitchingKeyBuildHelper {
key_switching_key_material,

View File

@@ -8,13 +8,13 @@ pub(super) struct OptionalEndSliceIter<'a, T> {
last: Option<&'a T>,
}
impl<'a, T> Clone for OptionalEndSliceIter<'a, T> {
impl<T> Clone for OptionalEndSliceIter<'_, T> {
fn clone(&self) -> Self {
*self
}
}
impl<'a, T> Copy for OptionalEndSliceIter<'a, T> {}
impl<T> Copy for OptionalEndSliceIter<'_, T> {}
impl<'a, T> OptionalEndSliceIter<'a, T> {
pub(super) fn len(&self) -> usize {
@@ -62,7 +62,7 @@ pub mod iter {
}
}
impl<'a, T> DoubleEndedIterator for OptionalEndSliceIterator<'a, T> {
impl<T> DoubleEndedIterator for OptionalEndSliceIterator<'_, T> {
fn next_back(&mut self) -> Option<Self::Item> {
if let Some(last) = self.last.take() {
Some(last)
@@ -72,7 +72,7 @@ pub mod iter {
}
}
impl<'a, T> ExactSizeIterator for OptionalEndSliceIterator<'a, T> {
impl<T> ExactSizeIterator for OptionalEndSliceIterator<'_, T> {
fn len(&self) -> usize {
self.slice_iter.len() + if self.last.is_some() { 1 } else { 0 }
}

View File

@@ -71,7 +71,7 @@ pub enum GenericPatternRef<'a> {
Enc(&'a FheString),
}
impl<'a> GenericPatternRef<'a> {
impl GenericPatternRef<'_> {
pub fn to_owned(self) -> GenericPattern {
match self {
GenericPatternRef::Clear(clear_string) => GenericPattern::Clear(clear_string.clone()),

View File

@@ -49,7 +49,7 @@ where
assert!(str.is_ascii() & !str.contains('\0'));
let padded = padding.map_or(false, |p| p != 0);
let padded = padding.is_some_and(|p| p != 0);
let num_blocks = self.num_ascii_blocks();
@@ -84,7 +84,7 @@ where
assert!(str.is_ascii() & !str.contains('\0'));
let padded = padding.map_or(false, |p| p != 0);
let padded = padding.is_some_and(|p| p != 0);
let num_blocks = self.num_ascii_blocks();

View File

@@ -1 +1 @@
nightly-2024-10-03
nightly-2024-11-29