Skip to content

Commit e5a9e5b

Browse files
authored
refactor: use simplified expression (#1012)
Signed-off-by: queryfast <queryfast@outlook.com>
1 parent a13c018 commit e5a9e5b

File tree

9 files changed

+13
-15
lines changed

9 files changed

+13
-15
lines changed

ec/src/hashing/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl ark_std::error::Error for HashToCurveError {}
3131
impl fmt::Display for HashToCurveError {
3232
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
3333
match self {
34-
Self::UnsupportedCurveError(s) | Self::MapToCurveError(s) => write!(f, "{}", s),
34+
Self::UnsupportedCurveError(s) | Self::MapToCurveError(s) => write!(f, "{s}"),
3535
}
3636
}
3737
}

ff-asm/src/context/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<'a> Context<'a> {
101101
let clobbers = self
102102
.used_registers
103103
.iter()
104-
.map(|l| format!("out({}) _,", l))
104+
.map(|l| format!("out({l}) _,"))
105105
.collect::<Vec<String>>()
106106
.join("\n");
107107
let options = "options(att_syntax)".to_string();

ff-asm/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ fn construct_asm_mul(ctx: &Context<'_>, limbs: usize) -> Vec<String> {
138138
let asm_instructions = RefCell::new(Vec::new());
139139

140140
let comment = |comment: &str| {
141-
asm_instructions
142-
.borrow_mut()
143-
.push(format!("// {}", comment));
141+
asm_instructions.borrow_mut().push(format!("// {comment}"));
144142
};
145143

146144
macro_rules! mulxq {

ff-macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn to_sign_and_limbs(input: TokenStream) -> TokenStream {
2222
let (is_positive, limbs) = utils::str_to_limbs(&num);
2323

2424
let limbs: String = limbs.join(", ");
25-
let limbs_and_sign = format!("({}", is_positive) + ", [" + &limbs + "])";
25+
let limbs_and_sign = format!("({is_positive}") + ", [" + &limbs + "])";
2626
let tuple: Expr = syn::parse_str(&limbs_and_sign).unwrap();
2727
quote::quote!(#tuple).into()
2828
}

ff/src/fields/models/fp/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ impl<P: FpConfig<N>, const N: usize> Display for Fp<P, N> {
678678
#[inline]
679679
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
680680
let string = self.into_bigint().to_string();
681-
write!(f, "{}", string)
681+
write!(f, "{string}")
682682
}
683683
}
684684

poly/src/polynomial/multivariate/sparse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl<F: Field, T: Term> fmt::Debug for SparsePolynomial<F, T> {
273273
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
274274
for (coeff, term) in self.terms.iter().filter(|(c, _)| !c.is_zero()) {
275275
if term.is_constant() {
276-
write!(f, "\n{:?}", coeff)?;
276+
write!(f, "\n{coeff:?}")?;
277277
} else {
278278
write!(f, "\n{:?} {:?}", coeff, term)?;
279279
}

poly/src/polynomial/univariate/dense.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ impl<F: Field> fmt::Debug for DensePolynomial<F> {
255255
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
256256
for (i, coeff) in self.coeffs.iter().enumerate().filter(|(_, c)| !c.is_zero()) {
257257
if i == 0 {
258-
write!(f, "\n{:?}", coeff)?;
258+
write!(f, "\n{coeff:?}")?;
259259
} else if i == 1 {
260-
write!(f, " + \n{:?} * x", coeff)?;
260+
write!(f, " + \n{coeff:?} * x")?;
261261
} else {
262-
write!(f, " + \n{:?} * x^{}", coeff, i)?;
262+
write!(f, " + \n{coeff:?} * x^{i}")?;
263263
}
264264
}
265265
Ok(())

poly/src/polynomial/univariate/sparse.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ impl<F: Field> fmt::Debug for SparsePolynomial<F> {
3232
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
3333
for (i, coeff) in self.coeffs.iter().filter(|(_, c)| !c.is_zero()) {
3434
if *i == 0 {
35-
write!(f, "\n{:?}", coeff)?;
35+
write!(f, "\n{coeff:?}")?;
3636
} else if *i == 1 {
37-
write!(f, " + \n{:?} * x", coeff)?;
37+
write!(f, " + \n{coeff:?} * x")?;
3838
} else {
39-
write!(f, " + \n{:?} * x^{}", coeff, i)?;
39+
write!(f, " + \n{coeff:?} * x^{i}")?;
4040
}
4141
}
4242
Ok(())

serialize/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl fmt::Display for SerializationError {
3131
),
3232
Self::InvalidData => write!(f, "the input buffer contained invalid data"),
3333
Self::UnexpectedFlags => write!(f, "the call expects empty flags"),
34-
Self::IoError(err) => write!(f, "I/O error: {:?}", err),
34+
Self::IoError(err) => write!(f, "I/O error: {err:?}"),
3535
}
3636
}
3737
}

0 commit comments

Comments
 (0)