mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-23 17:43:06 +03:00
clippy: fix ptr_arg
Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
parent
27c3d7b71b
commit
93369aed33
@ -41,7 +41,7 @@ impl ImportParser {
|
||||
let _res = self.core_packages.push(package.clone());
|
||||
}
|
||||
|
||||
pub fn get_import(&self, file_name: &String) -> Option<&Program> {
|
||||
pub fn get_import(&self, file_name: &str) -> Option<&Program> {
|
||||
self.imports.get(file_name)
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ pub fn new_scope(outer: String, inner: String) -> String {
|
||||
format!("{}_{}", outer, inner)
|
||||
}
|
||||
|
||||
pub fn is_in_scope(current_scope: &String, desired_scope: &String) -> bool {
|
||||
pub fn is_in_scope(current_scope: &str, desired_scope: &str) -> bool {
|
||||
current_scope.ends_with(desired_scope)
|
||||
}
|
||||
|
||||
@ -52,11 +52,11 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
self.identifiers.insert(name, value);
|
||||
}
|
||||
|
||||
pub(crate) fn get(&self, name: &String) -> Option<&ConstrainedValue<F, G>> {
|
||||
pub(crate) fn get(&self, name: &str) -> Option<&ConstrainedValue<F, G>> {
|
||||
self.identifiers.get(name)
|
||||
}
|
||||
|
||||
pub(crate) fn get_mut(&mut self, name: &String) -> Option<&mut ConstrainedValue<F, G>> {
|
||||
pub(crate) fn get_mut(&mut self, name: &str) -> Option<&mut ConstrainedValue<F, G>> {
|
||||
self.identifiers.get_mut(name)
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ impl<E: PairingEngine> From<CircuitSynthesizer<E>> for SerializedCircuit {
|
||||
let num_constraints = synthesizer.num_constraints();
|
||||
|
||||
// Serialize assignments
|
||||
fn get_serialized_assignments<E: PairingEngine>(assignments: &Vec<E::Fr>) -> Vec<SerializedField> {
|
||||
fn get_serialized_assignments<E: PairingEngine>(assignments: &[E::Fr]) -> Vec<SerializedField> {
|
||||
let mut serialized = vec![];
|
||||
|
||||
for assignment in assignments {
|
||||
@ -74,7 +74,7 @@ impl<E: PairingEngine> From<CircuitSynthesizer<E>> for SerializedCircuit {
|
||||
|
||||
// Serialize constraints
|
||||
fn get_serialized_constraints<E: PairingEngine>(
|
||||
constraints: &Vec<(E::Fr, Index)>,
|
||||
constraints: &[(E::Fr, Index)],
|
||||
) -> Vec<(SerializedField, SerializedIndex)> {
|
||||
let mut serialized = vec![];
|
||||
|
||||
@ -128,7 +128,7 @@ impl TryFrom<SerializedCircuit> for CircuitSynthesizer<Bls12_377> {
|
||||
fn try_from(serialized: SerializedCircuit) -> Result<CircuitSynthesizer<Bls12_377>, Self::Error> {
|
||||
// Deserialize assignments
|
||||
fn get_deserialized_assignments(
|
||||
assignments: &Vec<SerializedField>,
|
||||
assignments: &[SerializedField],
|
||||
) -> Result<Vec<<Bls12_377 as PairingEngine>::Fr>, FieldError> {
|
||||
let mut deserialized = vec![];
|
||||
|
||||
@ -146,7 +146,7 @@ impl TryFrom<SerializedCircuit> for CircuitSynthesizer<Bls12_377> {
|
||||
|
||||
// Deserialize constraints
|
||||
fn get_deserialized_constraints(
|
||||
constraints: &Vec<(SerializedField, SerializedIndex)>,
|
||||
constraints: &[(SerializedField, SerializedIndex)],
|
||||
) -> Result<Vec<(<Bls12_377 as PairingEngine>::Fr, Index)>, FieldError> {
|
||||
let mut deserialized = vec![];
|
||||
|
||||
|
@ -61,7 +61,7 @@ impl MainInput {
|
||||
}
|
||||
|
||||
/// Returns an `Option` of the main function input at `name`
|
||||
pub fn get(&self, name: &String) -> Option<Option<InputValue>> {
|
||||
pub fn get(&self, name: &str) -> Option<Option<InputValue>> {
|
||||
self.input.get(name).map(|input| input.clone())
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ impl Type {
|
||||
type_1_expanded.eq(&type_2_expanded) && dimensions_1_expanded.eq(&dimensions_2_expanded)
|
||||
}
|
||||
|
||||
pub fn outer_dimension(&self, dimensions: &Vec<usize>) -> Self {
|
||||
pub fn outer_dimension(&self, dimensions: &[usize]) -> Self {
|
||||
let type_ = self.clone();
|
||||
|
||||
if dimensions.len() > 1 {
|
||||
@ -91,7 +91,7 @@ impl Type {
|
||||
type_
|
||||
}
|
||||
|
||||
pub fn inner_dimension(&self, dimensions: &Vec<usize>) -> Self {
|
||||
pub fn inner_dimension(&self, dimensions: &[usize]) -> Self {
|
||||
let type_ = self.clone();
|
||||
|
||||
if dimensions.len() > 1 {
|
||||
@ -105,16 +105,16 @@ impl Type {
|
||||
}
|
||||
}
|
||||
|
||||
fn expand_array_type(type_: &Type, dimensions: &Vec<usize>) -> (Type, Vec<usize>) {
|
||||
fn expand_array_type(type_: &Type, dimensions: &[usize]) -> (Type, Vec<usize>) {
|
||||
if let Type::Array(nested_type, nested_dimensions) = type_ {
|
||||
// Expand nested array type
|
||||
let mut expanded_dimensions = dimensions.clone();
|
||||
let mut expanded_dimensions = dimensions.to_vec();
|
||||
expanded_dimensions.append(&mut nested_dimensions.clone());
|
||||
|
||||
expand_array_type(nested_type, &expanded_dimensions)
|
||||
} else {
|
||||
// Array type is fully expanded
|
||||
(type_.clone(), dimensions.clone())
|
||||
(type_.clone(), dimensions.to_vec())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user