From e31cd0bbf3650157bc3434d849e773bcf479ab8b Mon Sep 17 00:00:00 2001 From: brock elmore Date: Thu, 11 Jul 2024 17:03:38 -0700 Subject: [PATCH] lint --- crates/graph/src/nodes/context/variables.rs | 2 +- crates/graph/src/solvers/atoms.rs | 12 ++++++------ crates/solc-expressions/src/assign.rs | 2 +- crates/solc-expressions/src/func_call/helper.rs | 3 +-- crates/solc-expressions/src/variable.rs | 6 ++---- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/crates/graph/src/nodes/context/variables.rs b/crates/graph/src/nodes/context/variables.rs index a3573c69..e9ba4098 100644 --- a/crates/graph/src/nodes/context/variables.rs +++ b/crates/graph/src/nodes/context/variables.rs @@ -470,7 +470,7 @@ impl ContextNode { fields.iter().try_for_each(|field| { self.recursive_move_struct_field(new_cvarnode, *field, loc, analyzer) })?; - Ok(new_cvarnode.into()) + Ok(new_cvarnode) } else { Ok(var) } diff --git a/crates/graph/src/solvers/atoms.rs b/crates/graph/src/solvers/atoms.rs index 50d0e02d..c414f885 100644 --- a/crates/graph/src/solvers/atoms.rs +++ b/crates/graph/src/solvers/atoms.rs @@ -302,7 +302,7 @@ impl Atomize for Elem { match self { Elem::Arena(_) => { self.dearenaize_clone(arena) - .atoms_or_part(Some(&self), analyzer, arena) + .atoms_or_part(Some(self), analyzer, arena) } Elem::Concrete(_) | Elem::Reference(_) => AtomOrPart::Part(self.clone()), Elem::ConcreteDyn(_) => AtomOrPart::Part(self.clone()), @@ -311,17 +311,17 @@ impl Atomize for Elem { match collapse(*expr.lhs.clone(), expr.op, *expr.rhs.clone(), arena) { MaybeCollapsed::Concretes(_l, _r) => { let exec_res = expr.exec_op(true, analyzer, arena).unwrap(); - return exec_res.atoms_or_part(Some(&self), analyzer, arena); + return exec_res.atoms_or_part(Some(self), analyzer, arena); } MaybeCollapsed::Collapsed(elem) => { - return elem.atoms_or_part(Some(&self), analyzer, arena); + return elem.atoms_or_part(Some(self), analyzer, arena); } MaybeCollapsed::Not(..) => {} } match ( - expr.lhs.atoms_or_part(Some(&self), analyzer, arena), - expr.rhs.atoms_or_part(Some(&self), analyzer, arena), + expr.lhs.atoms_or_part(Some(self), analyzer, arena), + expr.rhs.atoms_or_part(Some(self), analyzer, arena), ) { (ref lp @ AtomOrPart::Part(ref l), ref rp @ AtomOrPart::Part(ref r)) => { // println!("part part"); @@ -373,7 +373,7 @@ impl Atomize for Elem { if res == Elem::Expr(expr.clone()) { AtomOrPart::Part(res) } else { - res.atoms_or_part(Some(&self), analyzer, arena) + res.atoms_or_part(Some(self), analyzer, arena) } } (Elem::ConcreteDyn(_), _) => AtomOrPart::Part(Elem::Null), diff --git a/crates/solc-expressions/src/assign.rs b/crates/solc-expressions/src/assign.rs index 5c9142e7..bf6787fc 100644 --- a/crates/solc-expressions/src/assign.rs +++ b/crates/solc-expressions/src/assign.rs @@ -3,7 +3,7 @@ use crate::{array::Array, variable::Variable, ContextBuilder, ExpressionParser, use graph::{ elem::{Elem, RangeElem}, nodes::{Concrete, ContextNode, ContextVarNode, ExprRet}, - AnalyzerBackend, ContextEdge, Edge, Node, + AnalyzerBackend, ContextEdge, Edge, }; use shared::{ExprErr, GraphError, IntoExprErr, RangeArena}; diff --git a/crates/solc-expressions/src/func_call/helper.rs b/crates/solc-expressions/src/func_call/helper.rs index ea6bc3f0..c3d4b554 100644 --- a/crates/solc-expressions/src/func_call/helper.rs +++ b/crates/solc-expressions/src/func_call/helper.rs @@ -654,8 +654,7 @@ pub trait CallerHelper: AnalyzerBackend + .into_iter() .map(|i| (i, new_in_inheritor)) .collect::>(); - while !struct_stack.is_empty() { - let (field, parent) = struct_stack.pop().unwrap(); + while let Some((field, parent)) = struct_stack.pop() { let underlying = field.underlying(analyzer).into_expr_err(loc)?; let new_field_in_inheritor = diff --git a/crates/solc-expressions/src/variable.rs b/crates/solc-expressions/src/variable.rs index 618574ee..d27a5e1f 100644 --- a/crates/solc-expressions/src/variable.rs +++ b/crates/solc-expressions/src/variable.rs @@ -567,8 +567,7 @@ pub trait Variable: AnalyzerBackend + Size .into_iter() .map(|i| (i, new_cvarnode)) .collect::>(); - while !struct_stack.is_empty() { - let (field, parent) = struct_stack.pop().unwrap(); + while let Some((field, parent)) = struct_stack.pop() { let underlying = field.underlying(self).into_expr_err(loc)?; let new_field_in_inheritor = self.add_node(Node::ContextVar(underlying.clone())); @@ -665,8 +664,7 @@ pub trait Variable: AnalyzerBackend + Size .into_iter() .map(|i| (i, new_cvarnode)) .collect::>(); - while !struct_stack.is_empty() { - let (field, parent) = struct_stack.pop().unwrap(); + while let Some((field, parent)) = struct_stack.pop() { let underlying = field.underlying(self).into_expr_err(loc)?; let new_field_in_inheritor = self.add_node(Node::ContextVar(underlying.clone()));