Skip to content

Commit

Permalink
chore: replace usage of &Vec<T> with &[T] in noirc_evaluator (#…
Browse files Browse the repository at this point in the history
…1298)

* refactor: use slice arg instead of vec reference

* style: handle `uninlined_format_args` clippy lint in noirc_frontend and noirc_evaluator
  • Loading branch information
erikareale authored May 5, 2023
1 parent 9740f54 commit 545340c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions crates/noirc_evaluator/src/ssa/acir_gen/operations/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use crate::{
// Generate gates which ensure that out_expr is a permutation of in_expr
// Returns the control bits of the sorting network used to generate the constrains
pub(crate) fn evaluate_permutation(
in_expr: &Vec<Expression>,
out_expr: &Vec<Expression>,
in_expr: &[Expression],
out_expr: &[Expression],
evaluator: &mut Evaluator,
) -> Vec<Witness> {
let bits = Vec::new();
Expand All @@ -27,9 +27,9 @@ pub(crate) fn evaluate_permutation(

// Same as evaluate_permutation() but uses the provided witness as network control bits
pub(crate) fn evaluate_permutation_with_witness(
in_expr: &Vec<Expression>,
out_expr: &Vec<Expression>,
bits: &Vec<Witness>,
in_expr: &[Expression],
out_expr: &[Expression],
bits: &[Witness],
evaluator: &mut Evaluator,
) {
let (w, b) = permutation_layer(in_expr, bits, false, evaluator);
Expand All @@ -47,14 +47,14 @@ pub(crate) fn evaluate_permutation_with_witness(
// in both cases it returns the witness of the network configuration
// if generate_witness is true, bits is ignored
fn permutation_layer(
in_expr: &Vec<Expression>,
in_expr: &[Expression],
bits: &[Witness],
generate_witness: bool,
evaluator: &mut Evaluator,
) -> (Vec<Witness>, Vec<Expression>) {
let n = in_expr.len();
if n == 1 {
return (Vec::new(), in_expr.clone());
return (Vec::new(), in_expr.to_vec());
}
let n1 = n / 2;

Expand Down
2 changes: 1 addition & 1 deletion crates/noirc_evaluator/src/ssa_refactor/ir/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn value(function: &Function, id: ValueId) -> String {
match &function.dfg[id] {
Value::NumericConstant { constant, typ } => {
let value = function.dfg[*constant].value();
format!("{} {}", typ, value)
format!("{typ} {value}")
}
Value::Function(id) => id.to_string(),
Value::Intrinsic(intrinsic) => intrinsic.to_string(),
Expand Down
2 changes: 1 addition & 1 deletion crates/noirc_frontend/src/hir_def/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ impl std::fmt::Display for Type {
write!(f, "fn({}) -> {}", args.join(", "), ret)
}
Type::Vec(element) => {
write!(f, "Vec<{}>", element)
write!(f, "Vec<{element}>")
}
}
}
Expand Down

0 comments on commit 545340c

Please sign in to comment.