Skip to content

Commit 64d38a0

Browse files
Merge pull request #498 from qfall/hotfix_clippy
Fix Overindentation marked by Clippy
2 parents 755223f + 249819e commit 64d38a0

File tree

184 files changed

+730
-730
lines changed

Some content is hidden

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

184 files changed

+730
-730
lines changed

benches/classic_crypto.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ mod rsa_textbook {
9292
///
9393
/// The following steps are made:
9494
/// 1. Generate two unequal primes `p` and `q` roughly of bit size `security_lvl / 2`
95-
/// (s.t. `N` is roughly of bit size `security_lvl`).
95+
/// (s.t. `N` is roughly of bit size `security_lvl`).
9696
/// 2. Compute `N = p * q`.
9797
/// 3. Compute Euler's Phi function `phi(N) = (p-1) * (q-1)`.
9898
/// 4. Choose `pk = 65537 = 0x10000000000000001` statically as public key (common as `enc` is very
@@ -153,7 +153,7 @@ mod rsa_textbook {
153153
/// Run textbook RSA encryption with 1024 bit security.
154154
/// 1. get (N, pk, sk) from a previously generated key pair with `gen(1024)`
155155
/// 2. run cycle of `dec(sk, enc(pk, msg)) == msg`,
156-
/// where `msg` is sampled uniformly at random in `[0, u64::MAX)`
156+
/// where `msg` is sampled uniformly at random in `[0, u64::MAX)`
157157
pub fn rsa_run_enc_dec() {
158158
let (modulus, pk, sk) = static_gen();
159159
let msg = Z::sample_uniform(0, u64::MAX).unwrap();
@@ -211,7 +211,7 @@ mod dh_ke {
211211
/// Run a Diffie-Hellman key exchange with precomputed public parameters with 1024 bit security.
212212
/// 1. get (p, g) from previously generated public parameters
213213
/// 2. run one cycle of `gen_key_pair` and `combine_to_shared_sk` on each end (2 times),
214-
/// i.e. one key exchange at both ends and compare the computed shared secrets
214+
/// i.e. one key exchange at both ends and compare the computed shared secrets
215215
pub fn dh_run() {
216216
let (modulus, generator) = static_gen_pp();
217217

src/error.rs

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515
//!
1616
//! **For developers:**
1717
//! - How to add an error to an `enum`? First of all, find a name
18-
//! that is not too specific for your current case s.t. it could be used in other
19-
//! contexts afterwards as well. Then, find the spot according to your chosen error
20-
//! name in a alphanumerically sorted way in the list of supported errors in the doc
21-
//! comment and inside the `enum` itself.
22-
//! Afterwards, add the error to the list of implemented error
23-
//! types in the doc comment of the `enum` with a short description when it is thrown.
24-
//! Probably use this description for the doc comment above the implementation of
25-
//! error in the `enum`. Then, add `#[error(<error msg>)]` to define the error message
26-
//! output once your error is thrown. Below, write down `<error name>(<input>),` to
27-
//! define the error with its name and possibly some inputs. The input can be of the
28-
//! form [`String`], but also another error, whose conversion must be declared via
29-
//! `#[from] OtherError`. It is best to use the existing structure as a guide. For any
30-
//! further information, check out the here used [`thiserror`]-crate.
18+
//! that is not too specific for your current case s.t. it could be used in other
19+
//! contexts afterwards as well. Then, find the spot according to your chosen error
20+
//! name in a alphanumerically sorted way in the list of supported errors in the doc
21+
//! comment and inside the `enum` itself.
22+
//! Afterwards, add the error to the list of implemented error
23+
//! types in the doc comment of the `enum` with a short description when it is thrown.
24+
//! Probably use this description for the doc comment above the implementation of
25+
//! error in the `enum`. Then, add `#[error(<error msg>)]` to define the error message
26+
//! output once your error is thrown. Below, write down `<error name>(<input>),` to
27+
//! define the error with its name and possibly some inputs. The input can be of the
28+
//! form [`String`], but also another error, whose conversion must be declared via
29+
//! `#[from] OtherError`. It is best to use the existing structure as a guide. For any
30+
//! further information, check out the here used [`thiserror`]-crate.
3131
3232
use std::ffi::NulError;
3333
use thiserror::Error;
@@ -37,35 +37,35 @@ use thiserror::Error;
3737
///
3838
/// Implemented error types:
3939
/// - [`ConversionError`](MathError::ConversionError) is thrown if a conversion
40-
/// between types is not possible.
40+
/// between types is not possible.
4141
/// - [`DivisionByZeroError`](MathError::DivisionByZeroError) is thrown if it is
42-
/// tried to perform a division by `0`.
42+
/// tried to perform a division by `0`.
4343
/// - [`InvalidExponent`](MathError::InvalidExponent) is thrown if an invalid
44-
/// exponent is used for a `pow` function.
44+
/// exponent is used for a `pow` function.
4545
/// - [`InvalidIntegerInput`](MathError::InvalidIntegerInput) is thrown if an
46-
/// integer input is provided as parameter that does not meet the conditions
47-
/// of that function.
46+
/// integer input is provided as parameter that does not meet the conditions
47+
/// of that function.
4848
/// - [`InvalidInterval`](MathError::InvalidInterval) is thrown if an invalid
49-
/// interval, e.g. of negative size, is provided.
49+
/// interval, e.g. of negative size, is provided.
5050
/// - [`InvalidModulus`](MathError::InvalidModulus) is thrown if an integer is
51-
/// provided, which is smaller than `2`.
51+
/// provided, which is smaller than `2`.
5252
/// - [`NulError`](MathError::NulError) is thrown if a [`NulError`] is thrown,
53-
/// which currently only happens if an invalid string is given to construct
54-
/// a [`CString`](std::ffi::CString).
53+
/// which currently only happens if an invalid string is given to construct
54+
/// a [`CString`](std::ffi::CString).
5555
/// - [`MismatchingMatrixDimension`](MathError::MismatchingMatrixDimension) is
56-
/// thrown if arithmetic is done with matrices of mismatching dimensions.
56+
/// thrown if arithmetic is done with matrices of mismatching dimensions.
5757
/// - [`MismatchingModulus`](MathError::MismatchingModulus) is thrown if any
58-
/// function is called on two objects with different modulus where equal
59-
/// modulus is required.
58+
/// function is called on two objects with different modulus where equal
59+
/// modulus is required.
6060
/// - [`NonPositive`](MathError::NonPositive) is thrown if the function expects
61-
/// a positive number, but a number smaller than `1` is provided.
61+
/// a positive number, but a number smaller than `1` is provided.
6262
/// - [`NoSquareMatrix`](MathError::NoSquareMatrix) is thrown if a matrix is
63-
/// not square.
63+
/// not square.
6464
/// - [`OutOfBounds`](MathError::OutOfBounds) is thrown if a provided index
65-
/// is not in a desired range.
65+
/// is not in a desired range.
6666
/// - [`VectorFunctionCalledOnNonVector`](MathError::VectorFunctionCalledOnNonVector)
67-
/// is thrown if a function defined on vectors was called on a matrix instance
68-
/// that is not a vector.
67+
/// is thrown if a function defined on vectors was called on a matrix instance
68+
/// that is not a vector.
6969
///
7070
/// # Examples
7171
/// ```
@@ -155,26 +155,26 @@ pub enum MathError {
155155
///
156156
/// Implemented error types:
157157
/// - [`InvalidMatrix`](StringConversionError::InvalidMatrix) is thrown if an
158-
/// invalid string input of a matrix is given.
158+
/// invalid string input of a matrix is given.
159159
/// - [`InvalidStringToPolyInput`](StringConversionError::InvalidStringToPolyInput)
160-
/// is thrown if an invalid string is given to construct a polynomial.
160+
/// is thrown if an invalid string is given to construct a polynomial.
161161
/// - [`InvalidStringToPolyMissingWhitespace`](StringConversionError::InvalidStringToPolyMissingWhitespace)
162-
/// is thrown if an invalid string is given to construct a polynomial which
163-
/// did not contain two whitespaces.
162+
/// is thrown if an invalid string is given to construct a polynomial which
163+
/// did not contain two whitespaces.
164164
/// - [`InvalidStringToPolyModulusInput`](StringConversionError::InvalidStringToPolyModulusInput)
165-
/// is thrown if an invalid string is given
166-
/// to construct a [`PolyOverZq`](crate::integer_mod_q::PolyOverZq), i.e. it is
167-
/// not formatted correctly.
165+
/// is thrown if an invalid string is given
166+
/// to construct a [`PolyOverZq`](crate::integer_mod_q::PolyOverZq), i.e. it is
167+
/// not formatted correctly.
168168
/// - [`InvalidStringToPolyRingZqInput`](StringConversionError::InvalidStringToPolyRingZqInput)
169-
/// is thrown if an invalid string is given
170-
/// to construct a [`PolynomialRingZq`](crate::integer_mod_q::PolynomialRingZq), i.e. it is
171-
/// not formatted correctly.
169+
/// is thrown if an invalid string is given
170+
/// to construct a [`PolynomialRingZq`](crate::integer_mod_q::PolynomialRingZq), i.e. it is
171+
/// not formatted correctly.
172172
/// - [`InvalidStringToQInput`](StringConversionError::InvalidStringToQInput)
173-
/// is thrown if an invalid string is given to construct a [`Q`](crate::rational::Q).
173+
/// is thrown if an invalid string is given to construct a [`Q`](crate::rational::Q).
174174
/// - [`InvalidStringToZInput`](StringConversionError::InvalidStringToZInput)
175-
/// is thrown if an invalid string is given to construct a [`Z`](crate::integer::Z).
175+
/// is thrown if an invalid string is given to construct a [`Z`](crate::integer::Z).
176176
/// - [`InvalidStringToZqInput`](StringConversionError::InvalidStringToZqInput)
177-
/// is thrown if an invalid string is given to construct a [`Zq`](crate::integer_mod_q::Zq).
177+
/// is thrown if an invalid string is given to construct a [`Zq`](crate::integer_mod_q::Zq).
178178
///
179179
/// # Examples
180180
/// ```

src/integer/mat_poly_over_z.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ mod vector;
3737
///
3838
/// Attributes:
3939
/// - `matrix`: holds [FLINT](https://flintlib.org/)'s [struct](fmpz_poly_mat_struct)
40-
/// of the [`PolyOverZ`](crate::integer::PolyOverZ) matrix
40+
/// of the [`PolyOverZ`](crate::integer::PolyOverZ) matrix
4141
///
4242
/// # Examples
4343
/// ## Matrix usage

src/integer/mat_poly_over_z/arithmetic/add.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ impl MatPolyOverZ {
110110
///
111111
/// # Errors and Failures
112112
/// - Returns a [`MathError`] of type
113-
/// [`MathError::MismatchingMatrixDimension`] if the matrix dimensions
114-
/// mismatch.
113+
/// [`MathError::MismatchingMatrixDimension`] if the matrix dimensions
114+
/// mismatch.
115115
pub fn add_safe(&self, other: &Self) -> Result<MatPolyOverZ, MathError> {
116116
if self.get_num_rows() != other.get_num_rows()
117117
|| self.get_num_columns() != other.get_num_columns()

src/integer/mat_poly_over_z/arithmetic/mul.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ impl MatPolyOverZ {
7171
///
7272
/// # Errors and Failures
7373
/// - Returns a [`MathError`] of type
74-
/// [`MathError::MismatchingMatrixDimension`] if the dimensions of `self`
75-
/// and `other` do not match for multiplication.
74+
/// [`MathError::MismatchingMatrixDimension`] if the dimensions of `self`
75+
/// and `other` do not match for multiplication.
7676
pub fn mul_safe(&self, other: &Self) -> Result<Self, MathError> {
7777
if self.get_num_columns() != other.get_num_rows() {
7878
return Err(MathError::MismatchingMatrixDimension(format!(

src/integer/mat_poly_over_z/arithmetic/sub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ impl MatPolyOverZ {
7070
/// ```
7171
/// # Errors
7272
/// - Returns a [`MathError`] of type
73-
/// [`MathError::MismatchingMatrixDimension`] if the matrix dimensions
74-
/// mismatch.
73+
/// [`MathError::MismatchingMatrixDimension`] if the matrix dimensions
74+
/// mismatch.
7575
pub fn sub_safe(&self, other: &Self) -> Result<MatPolyOverZ, MathError> {
7676
if self.get_num_rows() != other.get_num_rows()
7777
|| self.get_num_columns() != other.get_num_columns()

src/integer/mat_poly_over_z/coefficient_embedding.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl IntoCoefficientEmbedding<MatZ> for &MatPolyOverZ {
2828
///
2929
/// Parameters:
3030
/// - `size`: determines the number of rows of the embedding. It has to be larger
31-
/// than the degree of the polynomial.
31+
/// than the degree of the polynomial.
3232
///
3333
/// Returns a coefficient embedding as a matrix if `size` is large enough.
3434
///
@@ -48,7 +48,7 @@ impl IntoCoefficientEmbedding<MatZ> for &MatPolyOverZ {
4848
///
4949
/// # Panics ...
5050
/// - if `size` is not larger than the degree of the polynomial, i.e.
51-
/// not all coefficients can be embedded.
51+
/// not all coefficients can be embedded.
5252
fn into_coefficient_embedding(self, size: impl Into<i64>) -> MatZ {
5353
let size = size.into();
5454

src/integer/mat_poly_over_z/concat.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ impl Concatenate for &MatPolyOverZ {
3939
///
4040
/// # Errors and Failures
4141
/// - Returns a [`MathError`] of type
42-
/// [`MismatchingMatrixDimension`](MathError::MismatchingMatrixDimension)
43-
/// if the matrices can not be concatenated due to mismatching dimensions.
42+
/// [`MismatchingMatrixDimension`](MathError::MismatchingMatrixDimension)
43+
/// if the matrices can not be concatenated due to mismatching dimensions.
4444
fn concat_vertical(self, other: Self) -> Result<Self::Output, crate::error::MathError> {
4545
if self.get_num_columns() != other.get_num_columns() {
4646
return Err(MathError::MismatchingMatrixDimension(format!(
@@ -82,8 +82,8 @@ impl Concatenate for &MatPolyOverZ {
8282
///
8383
/// # Errors and Failures
8484
/// - Returns a [`MathError`] of type
85-
/// [`MismatchingMatrixDimension`](MathError::MismatchingMatrixDimension)
86-
/// if the matrices can not be concatenated due to mismatching dimensions.
85+
/// [`MismatchingMatrixDimension`](MathError::MismatchingMatrixDimension)
86+
/// if the matrices can not be concatenated due to mismatching dimensions.
8787
fn concat_horizontal(self, other: Self) -> Result<Self::Output, crate::error::MathError> {
8888
if self.get_num_rows() != other.get_num_rows() {
8989
return Err(MathError::MismatchingMatrixDimension(format!(

src/integer/mat_poly_over_z/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl MatPolyOverZ {
7474
///
7575
/// # Panics ...
7676
/// - if the provided number of rows and columns are not suited to create a matrix.
77-
/// For further information see [`MatPolyOverZ::new`].
77+
/// For further information see [`MatPolyOverZ::new`].
7878
pub fn identity(
7979
num_rows: impl TryInto<i64> + Display,
8080
num_cols: impl TryInto<i64> + Display,

src/integer/mat_poly_over_z/from.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ impl FromStr for MatPolyOverZ {
3232
///
3333
/// Parameters:
3434
/// - `string`: the matrix of form: `"[[poly_1, poly_2, poly_3],[poly_4, poly_5, poly_6]]"`
35-
/// for a 2x3 matrix where first three polynomials are in the first row
36-
/// and the second three are in the second row.
35+
/// for a 2x3 matrix where first three polynomials are in the first row
36+
/// and the second three are in the second row.
3737
///
3838
/// Returns a [`MatPolyOverZ`] or an error if the matrix is not formatted in a suitable way,
3939
/// the number of rows or columns is too large (must fit into [`i64`]),
@@ -69,11 +69,11 @@ impl FromStr for MatPolyOverZ {
6969
/// - if the number of rows or columns is too large (must fit into i64),
7070
/// - if the number of entries in rows is unequal, or
7171
/// - if an entry is not formatted correctly.
72-
/// For further information see [`PolyOverZ::from_str`].
72+
/// For further information see [`PolyOverZ::from_str`].
7373
///
7474
/// # Panics ...
7575
/// - if the provided number of rows and columns are not suited to create a matrix.
76-
/// For further information see [`MatPolyOverZ::new`].
76+
/// For further information see [`MatPolyOverZ::new`].
7777
fn from_str(string: &str) -> Result<Self, MathError> {
7878
let string_matrix = parse_matrix_string(string)?;
7979
let (num_rows, num_cols) = find_matrix_dimensions(&string_matrix)?;

0 commit comments

Comments
 (0)