mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-02 13:53:07 +00:00
New clippy lint
This commit is contained in:
parent
0e58efdcc1
commit
b97ec3bda1
@ -9,5 +9,5 @@ fn main() {
|
||||
args.next();
|
||||
let file_contents: Vec<_> = args.map(|path| fs::read_to_string(path).unwrap()).collect();
|
||||
let assembled = assemble_to_bytes(&file_contents[..]);
|
||||
println!("{}", encode(&assembled));
|
||||
println!("{}", encode(assembled));
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ impl Macro {
|
||||
self.params
|
||||
.iter()
|
||||
.position(|p| p == param)
|
||||
.unwrap_or_else(|| panic!("No such param: {} {:?}", param, &self.params))
|
||||
.unwrap_or_else(|| panic!("No such param: {param} {:?}", &self.params))
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ fn find_macros(files: &[File]) -> HashMap<MacroSignature, Macro> {
|
||||
items: items.clone(),
|
||||
};
|
||||
let old = macros.insert(signature.clone(), macro_);
|
||||
assert!(old.is_none(), "Duplicate macro signature: {:?}", signature);
|
||||
assert!(old.is_none(), "Duplicate macro signature: {signature:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -186,9 +186,9 @@ fn expand_macro_call(
|
||||
};
|
||||
let macro_ = macros
|
||||
.get(&signature)
|
||||
.unwrap_or_else(|| panic!("No such macro: {:?}", signature));
|
||||
.unwrap_or_else(|| panic!("No such macro: {signature:?}"));
|
||||
|
||||
let get_actual_label = |macro_label| format!("@{}.{}", macro_counter, macro_label);
|
||||
let get_actual_label = |macro_label| format!("@{macro_counter}.{macro_label}");
|
||||
|
||||
let get_arg = |var| {
|
||||
let param_index = macro_.get_param_index(var);
|
||||
@ -242,7 +242,7 @@ fn inline_constants(body: Vec<Item>, constants: &HashMap<String, U256>) -> Vec<I
|
||||
let resolve_const = |c| {
|
||||
*constants
|
||||
.get(&c)
|
||||
.unwrap_or_else(|| panic!("No such constant: {}", c))
|
||||
.unwrap_or_else(|| panic!("No such constant: {c}"))
|
||||
};
|
||||
|
||||
body.into_iter()
|
||||
@ -283,15 +283,15 @@ fn find_labels(
|
||||
| Item::Repeat(_, _)
|
||||
| Item::StackManipulation(_, _)
|
||||
| Item::MacroLabelDeclaration(_) => {
|
||||
panic!("Item should have been expanded already: {:?}", item);
|
||||
panic!("Item should have been expanded already: {item:?}");
|
||||
}
|
||||
Item::GlobalLabelDeclaration(label) => {
|
||||
let old = global_labels.insert(label.clone(), *offset);
|
||||
assert!(old.is_none(), "Duplicate global label: {}", label);
|
||||
assert!(old.is_none(), "Duplicate global label: {label}");
|
||||
}
|
||||
Item::LocalLabelDeclaration(label) => {
|
||||
let old = local_labels.insert(label.clone(), *offset);
|
||||
assert!(old.is_none(), "Duplicate local label: {}", label);
|
||||
assert!(old.is_none(), "Duplicate local label: {label}");
|
||||
}
|
||||
Item::Push(target) => *offset += 1 + push_target_size(target) as usize,
|
||||
Item::ProverInput(prover_input_fn) => {
|
||||
@ -319,7 +319,7 @@ fn assemble_file(
|
||||
| Item::Repeat(_, _)
|
||||
| Item::StackManipulation(_, _)
|
||||
| Item::MacroLabelDeclaration(_) => {
|
||||
panic!("Item should have been expanded already: {:?}", item);
|
||||
panic!("Item should have been expanded already: {item:?}");
|
||||
}
|
||||
Item::GlobalLabelDeclaration(_) | Item::LocalLabelDeclaration(_) => {
|
||||
// Nothing to do; we processed labels in the prior phase.
|
||||
@ -331,7 +331,7 @@ fn assemble_file(
|
||||
let offset = local_labels
|
||||
.get(&label)
|
||||
.or_else(|| global_labels.get(&label))
|
||||
.unwrap_or_else(|| panic!("No such label: {}", label));
|
||||
.unwrap_or_else(|| panic!("No such label: {label}"));
|
||||
// We want the BYTES_PER_OFFSET least significant bytes in BE order.
|
||||
// It's easiest to rev the first BYTES_PER_OFFSET bytes of the LE encoding.
|
||||
(0..BYTES_PER_OFFSET)
|
||||
@ -339,9 +339,9 @@ fn assemble_file(
|
||||
.map(|i| offset.to_le_bytes()[i as usize])
|
||||
.collect()
|
||||
}
|
||||
PushTarget::MacroLabel(v) => panic!("Macro label not in a macro: {}", v),
|
||||
PushTarget::MacroVar(v) => panic!("Variable not in a macro: {}", v),
|
||||
PushTarget::Constant(c) => panic!("Constant wasn't inlined: {}", c),
|
||||
PushTarget::MacroLabel(v) => panic!("Macro label not in a macro: {v}"),
|
||||
PushTarget::MacroVar(v) => panic!("Variable not in a macro: {v}"),
|
||||
PushTarget::Constant(c) => panic!("Constant wasn't inlined: {c}"),
|
||||
};
|
||||
code.push(get_push_opcode(target_bytes.len() as u8));
|
||||
code.extend(target_bytes);
|
||||
@ -362,9 +362,9 @@ fn push_target_size(target: &PushTarget) -> u8 {
|
||||
match target {
|
||||
PushTarget::Literal(n) => u256_to_trimmed_be_bytes(n).len() as u8,
|
||||
PushTarget::Label(_) => BYTES_PER_OFFSET,
|
||||
PushTarget::MacroLabel(v) => panic!("Macro label not in a macro: {}", v),
|
||||
PushTarget::MacroVar(v) => panic!("Variable not in a macro: {}", v),
|
||||
PushTarget::Constant(c) => panic!("Constant wasn't inlined: {}", c),
|
||||
PushTarget::MacroLabel(v) => panic!("Macro label not in a macro: {v}"),
|
||||
PushTarget::MacroVar(v) => panic!("Variable not in a macro: {v}"),
|
||||
PushTarget::Constant(c) => panic!("Constant wasn't inlined: {c}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ fn cost_estimate_item(item: &Item) -> u32 {
|
||||
Push(Label(_)) => cost_estimate_push(BYTES_PER_OFFSET as usize),
|
||||
ProverInput(_) => 1,
|
||||
StandardOp(op) => cost_estimate_standard_op(op.as_str()),
|
||||
_ => panic!("Unexpected item: {:?}", item),
|
||||
_ => panic!("Unexpected item: {item:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -328,7 +328,7 @@ impl<'a> Interpreter<'a> {
|
||||
if self.debug_offsets.contains(&self.offset) {
|
||||
println!("At {}, stack={:?}", self.offset_name(), self.stack());
|
||||
} else if let Some(label) = self.offset_label() {
|
||||
println!("At {}", label);
|
||||
println!("At {label}");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@ -134,6 +134,6 @@ pub(crate) fn get_opcode(mnemonic: &str) -> u8 {
|
||||
"REVERT" => 0xfd,
|
||||
"INVALID" => 0xfe,
|
||||
"SELFDESTRUCT" => 0xff,
|
||||
_ => panic!("Unrecognized mnemonic {}", mnemonic),
|
||||
_ => panic!("Unrecognized mnemonic {mnemonic}"),
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ fn expand(names: Vec<StackPlaceholder>, replacements: Vec<StackReplacement>) ->
|
||||
stack_blocks.insert(name.clone(), n);
|
||||
(0..n)
|
||||
.map(|i| {
|
||||
let literal_name = format!("@{}.{}", name, i);
|
||||
let literal_name = format!("@{name}.{i}");
|
||||
StackItem::NamedItem(literal_name)
|
||||
})
|
||||
.collect_vec()
|
||||
@ -52,7 +52,7 @@ fn expand(names: Vec<StackPlaceholder>, replacements: Vec<StackReplacement>) ->
|
||||
let n = *stack_blocks.get(&name).unwrap();
|
||||
(0..n)
|
||||
.map(|i| {
|
||||
let literal_name = format!("@{}.{}", name, i);
|
||||
let literal_name = format!("@{name}.{i}");
|
||||
StackItem::NamedItem(literal_name)
|
||||
})
|
||||
.collect_vec()
|
||||
@ -64,7 +64,7 @@ fn expand(names: Vec<StackPlaceholder>, replacements: Vec<StackReplacement>) ->
|
||||
StackReplacement::MacroLabel(_)
|
||||
| StackReplacement::MacroVar(_)
|
||||
| StackReplacement::Constant(_) => {
|
||||
panic!("Should have been expanded already: {:?}", item)
|
||||
panic!("Should have been expanded already: {item:?}")
|
||||
}
|
||||
})
|
||||
.collect_vec();
|
||||
@ -157,7 +157,7 @@ fn shortest_path(
|
||||
}
|
||||
}
|
||||
|
||||
panic!("No path found from {:?} to {:?}", src, dst)
|
||||
panic!("No path found from {src:?} to {dst:?}")
|
||||
}
|
||||
|
||||
/// A node in the priority queue used by Dijkstra's algorithm.
|
||||
@ -279,7 +279,7 @@ impl StackOp {
|
||||
PushTarget::MacroLabel(_)
|
||||
| PushTarget::MacroVar(_)
|
||||
| PushTarget::Constant(_) => {
|
||||
panic!("Target should have been expanded already: {:?}", target)
|
||||
panic!("Target should have been expanded already: {target:?}")
|
||||
}
|
||||
};
|
||||
// This is just a rough estimate; we can update it after implementing PUSH.
|
||||
@ -326,8 +326,8 @@ impl StackOp {
|
||||
match self {
|
||||
StackOp::Push(target) => Item::Push(target),
|
||||
Pop => Item::StandardOp("POP".into()),
|
||||
StackOp::Dup(n) => Item::StandardOp(format!("DUP{}", n)),
|
||||
StackOp::Swap(n) => Item::StandardOp(format!("SWAP{}", n)),
|
||||
StackOp::Dup(n) => Item::StandardOp(format!("DUP{n}")),
|
||||
StackOp::Swap(n) => Item::StandardOp(format!("SWAP{n}")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ mod bn {
|
||||
assert_eq!(stack, vec![U256::MAX, U256::MAX]);
|
||||
|
||||
// Multiple calls
|
||||
let ec_mul_hex = format!("0x{:x}", ec_mul);
|
||||
let ec_mul_hex = format!("0x{ec_mul:x}");
|
||||
let initial_stack = u256ify([
|
||||
"0xdeadbeef",
|
||||
s,
|
||||
@ -288,7 +288,7 @@ mod secp {
|
||||
assert_eq!(stack, u256ify([identity.1, identity.0])?);
|
||||
|
||||
// Multiple calls
|
||||
let ec_mul_hex = format!("0x{:x}", ec_mul);
|
||||
let ec_mul_hex = format!("0x{ec_mul:x}");
|
||||
let initial_stack = u256ify([
|
||||
"0xdeadbeef",
|
||||
s,
|
||||
|
||||
@ -45,7 +45,7 @@ impl<F: OEF<D>, const D: usize> Display for ExtensionAlgebra<F, D> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "({})", self.0[0])?;
|
||||
for i in 1..D {
|
||||
write!(f, " + ({})*b^{}", self.0[i], i)?;
|
||||
write!(f, " + ({})*b^{i}", self.0[i])?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ impl<F: RichField + Extendable<D>, const D: usize> InsertionGate<F, D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for InsertionGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}<D={}>", self, D)
|
||||
format!("{self:?}<D={D}>")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -24,7 +24,7 @@ pub(crate) fn bench_keccak<F: RichField>(c: &mut Criterion) {
|
||||
|
||||
pub(crate) fn bench_poseidon<F: Poseidon>(c: &mut Criterion) {
|
||||
c.bench_function(
|
||||
&format!("poseidon<{}, {}>", type_name::<F>(), SPONGE_WIDTH),
|
||||
&format!("poseidon<{}, {SPONGE_WIDTH}>", type_name::<F>()),
|
||||
|b| {
|
||||
b.iter_batched(
|
||||
|| F::rand_arr::<SPONGE_WIDTH>(),
|
||||
|
||||
@ -31,7 +31,7 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F>
|
||||
let x_squared = witness.get_target(self.x_squared);
|
||||
let x = x_squared.sqrt().unwrap();
|
||||
|
||||
println!("Square root: {}", x);
|
||||
println!("Square root: {x}");
|
||||
|
||||
out_buffer.set_target(self.x, x);
|
||||
}
|
||||
@ -75,7 +75,7 @@ fn main() -> Result<()> {
|
||||
let proof = data.prove(pw.clone())?;
|
||||
|
||||
let x_squared_actual = proof.public_inputs[0];
|
||||
println!("Field element (square): {}", x_squared_actual);
|
||||
println!("Field element (square): {x_squared_actual}");
|
||||
|
||||
data.verify(proof)
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ pub(crate) fn main() {
|
||||
// Print the constants in the format we prefer in our code.
|
||||
for chunk in constants.chunks(4) {
|
||||
for (i, c) in chunk.iter().enumerate() {
|
||||
print!("{:#018x},", c);
|
||||
print!("{c:#018x},");
|
||||
if i != chunk.len() - 1 {
|
||||
print!(" ");
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
||||
with_context!(
|
||||
self,
|
||||
level,
|
||||
&format!("verify one (of {}) query rounds", num_queries),
|
||||
&format!("verify one (of {num_queries}) query rounds"),
|
||||
self.fri_verifier_query_round::<C>(
|
||||
instance,
|
||||
challenges,
|
||||
@ -207,7 +207,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
||||
{
|
||||
with_context!(
|
||||
self,
|
||||
&format!("verify {}'th initial Merkle proof", i),
|
||||
&format!("verify {i}'th initial Merkle proof"),
|
||||
self.verify_merkle_proof_to_cap_with_cap_index::<H>(
|
||||
evals.clone(),
|
||||
x_index_bits,
|
||||
|
||||
@ -53,7 +53,7 @@ impl ArithmeticGate {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for ArithmeticGate {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
format!("{self:?}")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -51,7 +51,7 @@ impl<const D: usize> ArithmeticExtensionGate<D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for ArithmeticExtensionGate<D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
format!("{self:?}")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -49,7 +49,7 @@ impl<const B: usize> BaseSumGate<B> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize, const B: usize> Gate<F, D> for BaseSumGate<B> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?} + Base: {}", self, B)
|
||||
format!("{self:?} + Base: {B}")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -33,7 +33,7 @@ impl ConstantGate {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for ConstantGate {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
format!("{self:?}")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -70,7 +70,7 @@ impl<F: RichField + Extendable<D>, const D: usize> ExponentiationGate<F, D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for ExponentiationGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}<D={}>", self, D)
|
||||
format!("{self:?}<D={D}>")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -87,7 +87,7 @@ impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D>
|
||||
for HighDegreeInterpolationGate<F, D>
|
||||
{
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}<D={}>", self, D)
|
||||
format!("{self:?}<D={D}>")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -80,7 +80,7 @@ impl<F: RichField + Extendable<D>, const D: usize> LowDegreeInterpolationGate<F,
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for LowDegreeInterpolationGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}<D={}>", self, D)
|
||||
format!("{self:?}<D={D}>")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -48,7 +48,7 @@ impl<const D: usize> MulExtensionGate<D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for MulExtensionGate<D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
format!("{self:?}")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -98,7 +98,7 @@ impl<F: RichField + Extendable<D>, const D: usize> PoseidonGate<F, D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for PoseidonGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}<WIDTH={}>", self, SPONGE_WIDTH)
|
||||
format!("{self:?}<WIDTH={SPONGE_WIDTH}>")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -117,7 +117,7 @@ impl<F: RichField + Extendable<D> + Poseidon, const D: usize> PoseidonMdsGate<F,
|
||||
|
||||
impl<F: RichField + Extendable<D> + Poseidon, const D: usize> Gate<F, D> for PoseidonMdsGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}<WIDTH={}>", self, SPONGE_WIDTH)
|
||||
format!("{self:?}<WIDTH={SPONGE_WIDTH}>")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -115,7 +115,7 @@ impl<F: RichField + Extendable<D>, const D: usize> RandomAccessGate<F, D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for RandomAccessGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}<D={}>", self, D)
|
||||
format!("{self:?}<D={D}>")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -55,7 +55,7 @@ impl<const D: usize> ReducingGate<D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for ReducingGate<D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
format!("{self:?}")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -58,7 +58,7 @@ impl<const D: usize> ReducingExtensionGate<D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for ReducingExtensionGate<D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
format!("{self:?}")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -84,7 +84,7 @@ impl<F: RichField + Extendable<D>, const D: usize> U32AddManyGate<F, D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for U32AddManyGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
format!("{self:?}")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -86,7 +86,7 @@ impl<F: RichField + Extendable<D>, const D: usize> U32ArithmeticGate<F, D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for U32ArithmeticGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
format!("{self:?}")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -91,7 +91,7 @@ impl<F: RichField + Extendable<D>, const D: usize> ComparisonGate<F, D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for ComparisonGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}<D={}>", self, D)
|
||||
format!("{self:?}<D={D}>")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -48,7 +48,7 @@ impl<F: RichField + Extendable<D>, const D: usize> U32RangeCheckGate<F, D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for U32RangeCheckGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
format!("{self:?}")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -80,7 +80,7 @@ impl<F: RichField + Extendable<D>, const D: usize> U32SubtractionGate<F, D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for U32SubtractionGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
format!("{self:?}")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -31,7 +31,7 @@ pub fn log2_ceil(n: usize) -> usize {
|
||||
/// Computes `log_2(n)`, panicking if `n` is not a power of two.
|
||||
pub fn log2_strict(n: usize) -> usize {
|
||||
let res = n.trailing_zeros();
|
||||
assert!(n.wrapping_shr(res) == 1, "Not a power of two: {}", n);
|
||||
assert!(n.wrapping_shr(res) == 1, "Not a power of two: {n}");
|
||||
// Tell the optimizer about the semantics of `log2_strict`. i.e. it can replace `n` with
|
||||
// `1 << res` and vice versa.
|
||||
assume(n == 1 << res);
|
||||
|
||||
@ -84,7 +84,7 @@ impl<F: RichField + Extendable<D>, const D: usize> AssertLessThanGate<F, D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for AssertLessThanGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}<D={}>", self, D)
|
||||
format!("{self:?}<D={D}>")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
@ -74,7 +74,7 @@ impl<F: RichField + Extendable<D>, const D: usize> SwitchGate<F, D> {
|
||||
|
||||
impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for SwitchGate<F, D> {
|
||||
fn id(&self) -> String {
|
||||
format!("{:?}<D={}>", self, D)
|
||||
format!("{self:?}<D={D}>")
|
||||
}
|
||||
|
||||
fn eval_unfiltered(&self, vars: EvaluationVars<F, D>) -> Vec<F::Extension> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user