From 48db2d3a161df7162c66fbf1c106b2655286d7f4 Mon Sep 17 00:00:00 2001 From: Samuel Pastva Date: Wed, 28 Apr 2021 18:22:36 +0200 Subject: [PATCH] Fix new clippy errors. --- src/bdt/_impl_attribute.rs | 2 +- src/scc/algo_stability_analysis/_impl_stability_vector.rs | 4 ++-- src/scc/algo_stability_analysis/_impl_variable_stability.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bdt/_impl_attribute.rs b/src/bdt/_impl_attribute.rs index 1f92a9a..141670e 100644 --- a/src/bdt/_impl_attribute.rs +++ b/src/bdt/_impl_attribute.rs @@ -33,7 +33,7 @@ impl Attribute { if my_ctx.regulator == their_ctx.regulator && my_ctx.target == their_ctx.target { if my_ctx.context.len() > their_ctx.context.len() { for v in &their_ctx.context { - if my_ctx.context.iter().find(|it| *it == v).is_none() { + if !my_ctx.context.iter().any(|it| it == v) { return false; } } diff --git a/src/scc/algo_stability_analysis/_impl_stability_vector.rs b/src/scc/algo_stability_analysis/_impl_stability_vector.rs index 8bf1b27..ba9615a 100644 --- a/src/scc/algo_stability_analysis/_impl_stability_vector.rs +++ b/src/scc/algo_stability_analysis/_impl_stability_vector.rs @@ -106,7 +106,7 @@ impl StabilityVector { /// /// If the value is already present, current vector is only copied. pub fn add(&self, stability: Stability) -> StabilityVector { - self.clone().apply(|out| match stability { + (*self).apply(|out| match stability { Stability::True => out.has_true = true, Stability::False => out.has_false = true, Stability::Unstable => out.has_unstable = true, @@ -117,7 +117,7 @@ impl StabilityVector { !(self.has_unstable || self.has_false || self.has_true) } - pub fn to_json(&self) -> JsonValue { + pub fn export_json(&self) -> JsonValue { JsonValue::new_array().apply(|array| { if self.has_true { array.push("true").unwrap(); diff --git a/src/scc/algo_stability_analysis/_impl_variable_stability.rs b/src/scc/algo_stability_analysis/_impl_variable_stability.rs index 2218537..587b59b 100644 --- a/src/scc/algo_stability_analysis/_impl_variable_stability.rs +++ b/src/scc/algo_stability_analysis/_impl_variable_stability.rs @@ -95,7 +95,7 @@ impl VariableStability { for (vector, colors) in self.to_vec() { array .push(object! { - "vector": vector.to_json(), + "vector": vector.export_json(), "colors": colors.approx_cardinality(), }) .unwrap();