Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(optimizer): Update linting #1169

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ impl Dag {

pub struct DagBuilder<'dag>(unparametrized::DagBuilder<'dag>);

impl<'dag> DagBuilder<'dag> {
impl DagBuilder<'_> {
fn add_input(
&mut self,
out_precision: Precision,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl<'dag> DagCircuit<'dag> {
}
}

impl<'dag> fmt::Display for DagCircuit<'dag> {
impl fmt::Display for DagCircuit<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for op in self.get_operators_iter() {
writeln!(f, "{} <- {:?}", op.id, op.operator)?;
Expand All @@ -146,7 +146,7 @@ pub struct DagBuilder<'dag> {
pub(crate) circuit: String,
}

impl<'dag> DagBuilder<'dag> {
impl DagBuilder<'_> {
fn add_operator(&mut self, operator: Operator, location: Location) -> OperatorIndex {
debug_assert!(operator
.get_inputs_iter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub struct VariancedDagOperator<'a> {
id: OperatorIndex,
}

impl<'a> VariancedDagOperator<'a> {
impl VariancedDagOperator<'_> {
#[allow(unused)]
fn get_inputs_iter(&self) -> impl Iterator<Item = VariancedDagOperator<'_>> {
self.operator()
Expand All @@ -66,7 +66,7 @@ impl<'a> VariancedDagOperator<'a> {
.map(|n| self.dag.get_operator(n.id))
}

pub(crate) fn operator(&self) -> DagOperator<'a> {
pub(crate) fn operator(&self) -> DagOperator<'_> {
self.dag.dag.get_operator(self.id)
}

Expand All @@ -85,7 +85,7 @@ pub struct VariancedDagOperatorMut<'a> {
id: OperatorIndex,
}

impl<'a> VariancedDagOperatorMut<'a> {
impl VariancedDagOperatorMut<'_> {
fn get_inputs_iter(&self) -> impl Iterator<Item = VariancedDagOperator<'_>> {
self.operator()
.get_inputs_iter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,9 @@ impl InstructionKeys {
}

pub fn shared_keys(instructions_keys: &[Self], sharing: &KeySharing) -> Vec<Self> {
return instructions_keys
instructions_keys
.iter()
.map(|i| i.shared_keys_1(sharing))
.collect();
.collect()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -348,23 +348,23 @@ pub struct KeysetRestriction {

impl SearchSpaceRestriction for KeysetRestriction {
fn is_available_glwe(&self, _partition: PartitionIndex, glwe_params: GlweParameters) -> bool {
return self.info.lwe_bootstrap_keys.iter().any(|k| {
self.info.lwe_bootstrap_keys.iter().any(|k| {
k.glwe_dimension == glwe_params.glwe_dimension
&& k.polynomial_size == 2_u64.pow(glwe_params.log2_polynomial_size as u32)
});
})
}

fn is_available_macro(
&self,
_partition: PartitionIndex,
macro_parameters: MacroParameters,
) -> bool {
return self.info.lwe_bootstrap_keys.iter().any(|k| {
self.info.lwe_bootstrap_keys.iter().any(|k| {
k.glwe_dimension == macro_parameters.glwe_params.glwe_dimension
&& k.polynomial_size
== 2_u64.pow(macro_parameters.glwe_params.log2_polynomial_size as u32)
&& k.input_lwe_dimension == macro_parameters.internal_dim
});
})
}

fn is_available_micro_pbs(
Expand All @@ -373,14 +373,14 @@ impl SearchSpaceRestriction for KeysetRestriction {
macro_parameters: MacroParameters,
pbs_parameters: BrDecompositionParameters,
) -> bool {
return self.info.lwe_bootstrap_keys.iter().any(|k| {
self.info.lwe_bootstrap_keys.iter().any(|k| {
k.glwe_dimension == macro_parameters.glwe_params.glwe_dimension
&& k.polynomial_size
== 2_u64.pow(macro_parameters.glwe_params.log2_polynomial_size as u32)
&& k.input_lwe_dimension == macro_parameters.internal_dim
&& k.level_count == pbs_parameters.level
&& k.base_log == pbs_parameters.log2_base
});
})
}

fn is_available_micro_ks(
Expand All @@ -391,12 +391,12 @@ impl SearchSpaceRestriction for KeysetRestriction {
to_macro: MacroParameters,
ks_parameters: KsDecompositionParameters,
) -> bool {
return self.info.lwe_keyswitch_keys.iter().any(|k| {
self.info.lwe_keyswitch_keys.iter().any(|k| {
k.input_lwe_dimension == from_macro.glwe_params.sample_extract_lwe_dimension()
&& k.output_lwe_dimension == to_macro.internal_dim
&& k.level_count == ks_parameters.level
&& k.base_log == ks_parameters.log2_base
});
})
}

fn is_available_micro_fks(
Expand All @@ -407,12 +407,12 @@ impl SearchSpaceRestriction for KeysetRestriction {
to_macro: MacroParameters,
ks_parameters: KsDecompositionParameters,
) -> bool {
return self.info.lwe_keyswitch_keys.iter().any(|k| {
self.info.lwe_keyswitch_keys.iter().any(|k| {
k.input_lwe_dimension == from_macro.glwe_params.sample_extract_lwe_dimension()
&& k.output_lwe_dimension == to_macro.glwe_params.sample_extract_lwe_dimension()
&& k.level_count == ks_parameters.level
&& k.base_log == ks_parameters.log2_base
});
})
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl Viz for crate::dag::unparametrized::Dag {
}
}

impl<'dag> Viz for crate::dag::unparametrized::DagCircuit<'dag> {
impl Viz for crate::dag::unparametrized::DagCircuit<'_> {
fn viz_node(&self) -> String {
let mut graph: Vec<String> = vec![];
let circuit = &self.circuit;
Expand All @@ -72,7 +72,7 @@ style=\"rounded\"
}
}

impl<'dag> Viz for crate::dag::unparametrized::DagOperator<'dag> {
impl Viz for crate::dag::unparametrized::DagOperator<'_> {
fn viz_node(&self) -> String {
let input_string = self
.operator
Expand Down
Loading