diff --git a/crates/analyzers/src/bounds.rs b/crates/analyzers/src/bounds.rs index 636147a9..cf51782e 100644 --- a/crates/analyzers/src/bounds.rs +++ b/crates/analyzers/src/bounds.rs @@ -86,29 +86,25 @@ impl OrderedAnalysis { set.insert(init.into()); analyses.insert(source, set); } - ba.bound_changes - .iter() - .enumerate() - .for_each(|(_i, bound_change)| { - let (parts, unsat) = - range_parts(analyzer, arena, &ba.report_config, &bound_change.1); - let item = StrippedAnalysisItem { - init: false, - name: ba.var_display_name.clone(), - loc: LocSpan(bound_change.0 .1), - order: (bound_change.0.end() - bound_change.0.start()) as i32, //i as i32, - // storage: ba.storage.clone(), - ctx: ba.ctx, - ctx_conditionals: ba.conditionals(analyzer, arena), - parts, - unsat, - }; + ba.bound_changes.iter().for_each(|bound_change| { + let (parts, unsat) = range_parts(analyzer, arena, &ba.report_config, &bound_change.1); + let item = StrippedAnalysisItem { + init: false, + name: ba.var_display_name.clone(), + loc: LocSpan(bound_change.0 .1), + order: (bound_change.0.end() - bound_change.0.start()) as i32, //i as i32, + // storage: ba.storage.clone(), + ctx: ba.ctx, + ctx_conditionals: ba.conditionals(analyzer, arena), + parts, + unsat, + }; - let entry = analyses - .entry(*LocSpan(bound_change.0 .1).source()) - .or_default(); - entry.insert(item); - }); + let entry = analyses + .entry(*LocSpan(bound_change.0 .1).source()) + .or_default(); + entry.insert(item); + }); Self { analyses } } diff --git a/crates/analyzers/src/var_analyzer/mod.rs b/crates/analyzers/src/var_analyzer/mod.rs index 26399012..ed28ec7a 100644 --- a/crates/analyzers/src/var_analyzer/mod.rs +++ b/crates/analyzers/src/var_analyzer/mod.rs @@ -79,8 +79,7 @@ impl VarBoundAnalysis { .collect::>(); // create the bound strings deps.iter() - .enumerate() - .filter_map(|(_i, (_name, cvar))| { + .filter_map(|(_name, cvar)| { let range = cvar.ref_range(analyzer).unwrap()?; let parts = range_parts(analyzer, arena, &self.report_config, &range).0; Some((cvar.display_name(analyzer).unwrap(), parts)) diff --git a/crates/analyzers/src/var_analyzer/report_display.rs b/crates/analyzers/src/var_analyzer/report_display.rs index 403454bb..368f1659 100644 --- a/crates/analyzers/src/var_analyzer/report_display.rs +++ b/crates/analyzers/src/var_analyzer/report_display.rs @@ -38,8 +38,7 @@ impl ReportDisplay for VarBoundAnalysis { labels.extend( self.bound_changes .iter() - .enumerate() - .map(|(_i, bound_change)| { + .map(|bound_change| { let (parts, unsat) = range_parts(analyzer, arena, &self.report_config, &bound_change.1); AnalysisItem { diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index b4761afe..eff1d308 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -12,7 +12,7 @@ use shared::{GraphDot, USE_DEBUG_SITE}; use ariadne::sources; use clap::{ArgAction, Parser, ValueHint}; -use tracing::{debug, error, info, trace, warn}; +use tracing::{error, trace}; use tracing_subscriber::{prelude::*, Registry}; use std::{ diff --git a/crates/graph/src/nodes/context/versioning.rs b/crates/graph/src/nodes/context/versioning.rs index 0af39443..3629ca91 100644 --- a/crates/graph/src/nodes/context/versioning.rs +++ b/crates/graph/src/nodes/context/versioning.rs @@ -300,7 +300,7 @@ impl ContextNode { Some(CallFork::Call(call)) => format!("call {{ {} }}", call.path(analyzer)), None => unreachable!(), }; - Err(GraphError::ChildRedefinition(panic!( + Err(GraphError::ChildRedefinition(format!( "This is a bug. Tried to redefine a child context, parent:\n{}, current child:\n{},\nnew child: Fork({}, {})", self.path(analyzer), child_str, @@ -388,7 +388,7 @@ impl ContextNode { None => unreachable!(), }; tracing::trace!("Error setting child as a call"); - Err(GraphError::ChildRedefinition(panic!( + Err(GraphError::ChildRedefinition(format!( "This is a bug. Tried to redefine a child context, parent: {}, current child: {}, new child: {}", self.path(analyzer), child_str, diff --git a/crates/graph/src/range/elem/elem_enum/arena.rs b/crates/graph/src/range/elem/elem_enum/arena.rs index 49582f96..6472b2b7 100644 --- a/crates/graph/src/range/elem/elem_enum/arena.rs +++ b/crates/graph/src/range/elem/elem_enum/arena.rs @@ -45,7 +45,7 @@ impl RangeArenaLike> for RangeArena> { } _ => format!("{elem}"), } - }; + } format!("{i}: {}", fmt(elem, analyzer)) }) @@ -125,13 +125,6 @@ impl RangeArenaLike> for RangeArena> { self.map.insert(Elem::Null, 0); } - let nulls = self.ranges.iter().fold(0, |mut acc, e| { - if matches!(e, Elem::Null) { - acc += 1; - } - acc - }); - // println!( // "{}\nhad cycle:\n{:?}", // self.debug_str(analyzer), diff --git a/crates/graph/src/range/elem/elem_enum/impls.rs b/crates/graph/src/range/elem/elem_enum/impls.rs index 8ef2a405..2b56f4d6 100644 --- a/crates/graph/src/range/elem/elem_enum/impls.rs +++ b/crates/graph/src/range/elem/elem_enum/impls.rs @@ -63,17 +63,14 @@ impl Elem { Elem::Reference(reference) => { format!("Ref-CVar{}", reference.idx.index()) } - Elem::ConcreteDyn(range_dyn) => { + Elem::ConcreteDyn(_range_dyn) => { format!("concdyn-{}", self) } - Elem::Concrete(range_concrete) => { + Elem::Concrete(_range_concrete) => { format!("conc-{}", self) } - Elem::Expr(range_expr) => { + Elem::Expr(_range_expr) => { // Unbox and check the lhs and rhs to see if they are arena indices - let lhs_str = range_expr.lhs.arena_graph_node_label(); - let rhs_str = range_expr.rhs.arena_graph_node_label(); - let op = range_expr.op.clone(); format!("expr-{}", &self) } Elem::Arena(arena_idx) => { diff --git a/crates/graph/src/range/elem/expr/simplify/ords.rs b/crates/graph/src/range/elem/expr/simplify/ords.rs index f140a5db..bc288e96 100644 --- a/crates/graph/src/range/elem/expr/simplify/ords.rs +++ b/crates/graph/src/range/elem/expr/simplify/ords.rs @@ -15,6 +15,7 @@ pub struct Ords { pub x_ord_one: Option, } +#[allow(dead_code)] impl Ords { pub fn new( x: &Elem, diff --git a/crates/graph/src/range/elem/expr/simplify/sub.rs b/crates/graph/src/range/elem/expr/simplify/sub.rs index d99f2d85..a941bcd4 100644 --- a/crates/graph/src/range/elem/expr/simplify/sub.rs +++ b/crates/graph/src/range/elem/expr/simplify/sub.rs @@ -122,7 +122,7 @@ pub fn sub_ord_rules( let rhs = x_lte_z && y_gt_zero; let false_cond = lhs || rhs; - if x_lte_z && y_gte_zero { + if x_gte_z && y_lte_zero { Some(Elem::from(true)) } else if false_cond { Some(Elem::from(false)) diff --git a/crates/graph/src/range/elem/map_or_array.rs b/crates/graph/src/range/elem/map_or_array.rs index 2f1f0e08..8e9d7048 100644 --- a/crates/graph/src/range/elem/map_or_array.rs +++ b/crates/graph/src/range/elem/map_or_array.rs @@ -286,8 +286,8 @@ impl RangeElem for RangeDyn { .map(|(k, (v, op))| { let mut new_k = k.clone(); let mut new_v = v.clone(); - new_k.arenaize(analyzer, arena); - new_v.arenaize(analyzer, arena); + let _ = new_k.arenaize(analyzer, arena); + let _ = new_v.arenaize(analyzer, arena); (new_k, (new_v, *op)) }) .collect(); diff --git a/crates/graph/src/range/exec/math_ops/sub.rs b/crates/graph/src/range/exec/math_ops/sub.rs index acc5e1d1..7030e3d2 100644 --- a/crates/graph/src/range/exec/math_ops/sub.rs +++ b/crates/graph/src/range/exec/math_ops/sub.rs @@ -190,7 +190,7 @@ pub fn exec_sub( rhs_max: &Elem, maximize: bool, wrapping: bool, - analyzer: &impl GraphBackend, + _analyzer: &impl GraphBackend, arena: &mut RangeArena>, ) -> Option> { // quick check if rhs is const and zero, if so return min or max diff --git a/crates/graph/src/solvers/dl.rs b/crates/graph/src/solvers/dl.rs index 68782961..109887fa 100644 --- a/crates/graph/src/solvers/dl.rs +++ b/crates/graph/src/solvers/dl.rs @@ -257,10 +257,7 @@ impl DLSolver { }) .collect::>>>>(); // println!("normalized map: {res:#?}"); - match res { - Some(t) => t, - None => Default::default(), - } + res.unwrap_or_default() } pub fn dl_solvable_constraints(&self) -> Vec>> { diff --git a/crates/pyrometer/src/analyzer.rs b/crates/pyrometer/src/analyzer.rs index 943f6966..b5c04553 100644 --- a/crates/pyrometer/src/analyzer.rs +++ b/crates/pyrometer/src/analyzer.rs @@ -4,12 +4,11 @@ use graph::elem::Elem; use graph::{nodes::*, ContextEdge, Edge, Node, VarType}; use reqwest::Client; use serde::{Deserialize, Serialize}; -use shared::GraphDot; use shared::{AnalyzerLike, GraphLike, JoinStats, NodeIdx, Search}; use shared::{RangeArena, USE_DEBUG_SITE}; use solc_expressions::{ExprErr, FnCallBuilder, IntoExprErr, StatementParser}; use tokio::runtime::Runtime; -use tracing::{debug, error, info, trace, warn}; +use tracing::{error, trace, warn}; use ahash::AHashMap; use ariadne::{Cache, Color, Config, Fmt, Label, Report, ReportKind, Source, Span}; diff --git a/crates/pyrometer/src/graph_backend.rs b/crates/pyrometer/src/graph_backend.rs index 64ad9537..b99f98ae 100644 --- a/crates/pyrometer/src/graph_backend.rs +++ b/crates/pyrometer/src/graph_backend.rs @@ -181,7 +181,7 @@ impl TryFrom<&RangeArena>> for Elems { let mut inner = Vec::new(); for elem in &arena.ranges { // Get the map value - if let Some(map_value) = arena.map.get(&elem).copied() { + if let Some(map_value) = arena.map.get(elem).copied() { // println!("Adding idx {} to elems {}", map_value, elem); inner.push((map_value, elem.clone())); } else { @@ -287,11 +287,10 @@ impl Elems { existing_node_idx } else { // make a new ContextVar Node for the Arena graph - let new_node_idx = graph.add_node(ArenaNode::CVAR(format!( - "{}", - dep_elem.as_dot_str(graph_backend, arena) - ))); - dependency_map.insert(dep_elem.clone(), new_node_idx); + let new_node_idx = graph.add_node(ArenaNode::CVAR( + dep_elem.as_dot_str(graph_backend, arena).to_string(), + )); + dependency_map.insert(dep_elem, new_node_idx); new_node_idx }; // add an edge from the node to its dependency node @@ -302,13 +301,13 @@ impl Elems { } Elem::ConcreteDyn(_range_dyn) => { let node_str = elem.arena_graph_node_label(); - let node_idx = graph.add_node(ArenaNode::ELEM(node_str)); - node_idx + + graph.add_node(ArenaNode::ELEM(node_str)) } Elem::Concrete(_range_concrete) => { let node_str = elem.arena_graph_node_label(); - let node_idx = graph.add_node(ArenaNode::ELEM(node_str)); - node_idx + + graph.add_node(ArenaNode::ELEM(node_str)) } Elem::Expr(range_expr) => { let node_str = elem.arena_graph_node_label(); @@ -326,17 +325,16 @@ impl Elems { .collect::>(); context_var_nodes.iter().for_each(|dep_elem| { let dep_node_idx = if let Some(&existing_node_idx) = - dependency_map.get(&dep_elem) + dependency_map.get(dep_elem) { // don't make a new ContextVar node, just use the existing one existing_node_idx } else { // make a new ContextVar Node for the Arena graph - let new_node_idx = graph.add_node(ArenaNode::CVAR(format!( - "{}", - dep_elem.as_dot_str(graph_backend, arena) - ))); - dependency_map.insert(dep_elem.clone(), new_node_idx); + let new_node_idx = graph.add_node(ArenaNode::CVAR( + dep_elem.as_dot_str(graph_backend, arena).to_string(), + )); + dependency_map.insert(*dep_elem, new_node_idx); new_node_idx }; // use `update_edge` to avoid adding duplicate edges @@ -360,17 +358,16 @@ impl Elems { .collect::>(); context_var_nodes.iter().for_each(|dep_elem| { let dep_node_idx = if let Some(&existing_node_idx) = - dependency_map.get(&dep_elem) + dependency_map.get(dep_elem) { // don't make a new ContextVar node, just use the existing one existing_node_idx } else { // make a new ContextVar Node for the Arena graph - let new_node_idx = graph.add_node(ArenaNode::CVAR(format!( - "{}", - dep_elem.as_dot_str(graph_backend, arena) - ))); - dependency_map.insert(dep_elem.clone(), new_node_idx); + let new_node_idx = graph.add_node(ArenaNode::CVAR( + dep_elem.as_dot_str(graph_backend, arena).to_string(), + )); + dependency_map.insert(*dep_elem, new_node_idx); new_node_idx }; // use `update_edge` to avoid adding duplicate edges @@ -402,9 +399,9 @@ impl Elems { ); } Elem::Null => { - let node_str = format!("null"); - let node_idx = graph.add_node(ArenaNode::ELEM(node_str)); - node_idx + let node_str = "null".to_string(); + + graph.add_node(ArenaNode::ELEM(node_str)) } }; @@ -514,20 +511,16 @@ flowchart TB let nodes_str = graph .node_indices() - .map(|idx| { - let node_str = arena_mermaid_node(graph, "\t", idx, true, true, None); - node_str - }) + .map(|idx| arena_mermaid_node(graph, "\t", idx, true, true, None)) .collect::>() .join("\n"); let edges_str = graph .edge_indices() - .enumerate() - .map(|(_i, edge)| { + .map(|edge| { let (from, to) = graph.edge_endpoints(edge).unwrap(); let edge_label = format!("{}", graph[edge]); - if edge_label == "" { + if edge_label.is_empty() { // don't do a label format!(" {} --> {}", from.index(), to.index(),) } else { @@ -549,8 +542,7 @@ flowchart TB // Make an invisible node that holds all our edge information for coloring later on frontend let data_str = graph .edge_indices() - .enumerate() - .map(|(_i, edge)| { + .map(|edge| { let (from, to) = graph.edge_endpoints(edge).unwrap(); format!("LS-{}_LE-{}_{}", from.index(), to.index(), &graph[edge]) }) diff --git a/crates/solc-expressions/src/array.rs b/crates/solc-expressions/src/array.rs index a1d61761..de87e1ef 100644 --- a/crates/solc-expressions/src/array.rs +++ b/crates/solc-expressions/src/array.rs @@ -27,7 +27,7 @@ pub trait Array: AnalyzerBackend + Sized { ctx: ContextNode, ) -> Result<(), ExprErr> { self.parse_ctx_expr(arena, ty_expr, ctx)?; - self.apply_to_edges(ctx, ty_expr.loc(), arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, ty_expr.loc(), arena, &|analyzer, _arena, ctx, loc| { if let Some(ret) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? { if matches!(ret, ExprRet::CtxKilled(_)) { ctx.push_expr(ret, analyzer).into_expr_err(loc)?; diff --git a/crates/solc-expressions/src/bin_op.rs b/crates/solc-expressions/src/bin_op.rs index 57aad7ff..cb52ed98 100644 --- a/crates/solc-expressions/src/bin_op.rs +++ b/crates/solc-expressions/src/bin_op.rs @@ -378,7 +378,7 @@ pub trait BinOp: AnalyzerBackend + Sized { fn checked_require_mod_div( &mut self, arena: &mut RangeArena>, - lhs: ContextVarNode, + _lhs: ContextVarNode, rhs: ContextVarNode, loc: Loc, ctx: ContextNode, diff --git a/crates/solc-expressions/src/cmp.rs b/crates/solc-expressions/src/cmp.rs index e66b53f7..8cb9fba3 100644 --- a/crates/solc-expressions/src/cmp.rs +++ b/crates/solc-expressions/src/cmp.rs @@ -64,7 +64,7 @@ pub trait Cmp: AnalyzerBackend + Sized { RangeOp::Not, Elem::Null, )); - elem.arenaize(self, arena); + let _ = elem.arenaize(self, arena); let mut range = SolcRange::new(elem.clone(), elem, vec![]); range.cache_eval(self, arena).into_expr_err(loc)?; diff --git a/crates/solc-expressions/src/context_builder/expr.rs b/crates/solc-expressions/src/context_builder/expr.rs index ded16451..4c47b50c 100644 --- a/crates/solc-expressions/src/context_builder/expr.rs +++ b/crates/solc-expressions/src/context_builder/expr.rs @@ -385,7 +385,7 @@ pub trait ExpressionParser: } self.parse_ctx_expr(arena, expr, ctx)?; - self.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, loc| { tracing::trace!("Delete variable pop"); let Some(ret) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs( diff --git a/crates/solc-expressions/src/context_builder/stmt.rs b/crates/solc-expressions/src/context_builder/stmt.rs index 07137a0f..d3c52d7d 100644 --- a/crates/solc-expressions/src/context_builder/stmt.rs +++ b/crates/solc-expressions/src/context_builder/stmt.rs @@ -236,7 +236,7 @@ pub trait StatementParser: ctx_node.into(), *loc, arena, - &|analyzer, arena, ctx, loc| { + &|analyzer, _arena, ctx, loc| { if ctx.killed_or_ret(analyzer).into_expr_err(loc)? { tracing::trace!("killing due to bad funciton call"); let res = ContextNode::from(ctx_node) @@ -415,7 +415,7 @@ pub trait StatementParser: ctx, *loc, arena, - &|analyzer, arena, ctx, loc| { + &|analyzer, _arena, ctx, loc| { if ctx.killed_or_ret(analyzer).into_expr_err(loc)? { tracing::trace!("killing due to bad expr"); ContextNode::from(parent.into()) @@ -550,7 +550,7 @@ pub trait StatementParser: if let Some(parent) = parent_ctx { let parent = ContextNode::from(parent.into()); let res = - self.apply_to_edges(parent, *loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(parent, *loc, arena, &|analyzer, _arena, ctx, loc| { let res = ctx .kill(analyzer, loc, KilledKind::Revert) .into_expr_err(loc); diff --git a/crates/solc-expressions/src/func_call/func_caller.rs b/crates/solc-expressions/src/func_call/func_caller.rs index 143b316b..e30f639d 100644 --- a/crates/solc-expressions/src/func_call/func_caller.rs +++ b/crates/solc-expressions/src/func_call/func_caller.rs @@ -81,7 +81,7 @@ impl<'a> NamedOrUnnamedArgs<'a> { Ok(()) })?; if !inner.is_empty() { - analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_tmp_expr(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoLhs( loc, @@ -113,7 +113,7 @@ impl<'a> NamedOrUnnamedArgs<'a> { Ok(()) })?; if !inner.is_empty() { - analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_tmp_expr(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoLhs( loc, @@ -132,7 +132,7 @@ impl<'a> NamedOrUnnamedArgs<'a> { Ok(()) })?; if !inner.is_empty() { - analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_tmp_expr(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoLhs( loc, diff --git a/crates/solc-expressions/src/func_call/helper.rs b/crates/solc-expressions/src/func_call/helper.rs index e5d87812..3def7e6d 100644 --- a/crates/solc-expressions/src/func_call/helper.rs +++ b/crates/solc-expressions/src/func_call/helper.rs @@ -142,7 +142,7 @@ pub trait CallerHelper: AnalyzerBackend + .try_for_each(|input| self.parse_input(arena, ctx, loc, input, &append))?; if !inputs.is_empty() { - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_tmp_expr(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoLhs( loc, @@ -165,7 +165,7 @@ pub trait CallerHelper: AnalyzerBackend + append: &Rc>, ) -> Result<(), ExprErr> { self.parse_ctx_expr(arena, input, ctx)?; - self.apply_to_edges(ctx, input.loc(), arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, input.loc(), arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoLhs( loc, diff --git a/crates/solc-expressions/src/func_call/internal_call.rs b/crates/solc-expressions/src/func_call/internal_call.rs index d771fbab..89c10602 100644 --- a/crates/solc-expressions/src/func_call/internal_call.rs +++ b/crates/solc-expressions/src/func_call/internal_call.rs @@ -148,7 +148,7 @@ pub trait InternalFuncCaller: Ok(()) }) })?; - self.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, _loc| { + self.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, _loc| { ctx.push_expr(ExprRet::Single(cvar), analyzer) .into_expr_err(*loc)?; Ok(()) diff --git a/crates/solc-expressions/src/func_call/intrinsic_call/abi.rs b/crates/solc-expressions/src/func_call/intrinsic_call/abi.rs index 589b729d..1651866f 100644 --- a/crates/solc-expressions/src/func_call/intrinsic_call/abi.rs +++ b/crates/solc-expressions/src/func_call/intrinsic_call/abi.rs @@ -94,7 +94,7 @@ pub trait AbiCaller: AnalyzerBackend + Siz } let input_exprs = input_exprs.unnamed_args().unwrap(); self.parse_ctx_expr(arena, &input_exprs[1], ctx)?; - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs( loc, diff --git a/crates/solc-expressions/src/func_call/intrinsic_call/block.rs b/crates/solc-expressions/src/func_call/intrinsic_call/block.rs index 36755007..ccf01350 100644 --- a/crates/solc-expressions/src/func_call/intrinsic_call/block.rs +++ b/crates/solc-expressions/src/func_call/intrinsic_call/block.rs @@ -26,7 +26,7 @@ pub trait BlockCaller: AnalyzerBackend + S match &*func_name { "blockhash" => { input_exprs.parse_n(arena, 1, self, ctx, loc)?; - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(input) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs( loc, diff --git a/crates/solc-expressions/src/func_call/intrinsic_call/constructors.rs b/crates/solc-expressions/src/func_call/intrinsic_call/constructors.rs index 88ce7772..22bcf921 100644 --- a/crates/solc-expressions/src/func_call/intrinsic_call/constructors.rs +++ b/crates/solc-expressions/src/func_call/intrinsic_call/constructors.rs @@ -126,7 +126,7 @@ pub trait ConstructorCaller: if !input_exprs.is_empty() { self.parse_ctx_expr(arena, &input_exprs.unnamed_args().unwrap()[0], ctx)?; } - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { if !input_exprs.is_empty() { let Some(ret) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs(loc, "Contract creation failed".to_string())); diff --git a/crates/solc-expressions/src/func_call/intrinsic_call/dyn_builtin.rs b/crates/solc-expressions/src/func_call/intrinsic_call/dyn_builtin.rs index d7f88fac..410d36aa 100644 --- a/crates/solc-expressions/src/func_call/intrinsic_call/dyn_builtin.rs +++ b/crates/solc-expressions/src/func_call/intrinsic_call/dyn_builtin.rs @@ -51,7 +51,7 @@ pub trait DynBuiltinCaller: AnalyzerBackend v, None => { @@ -141,7 +141,7 @@ pub trait IntrinsicFuncCaller: None, None, )?; - analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let var = match ContextVar::maybe_from_user_ty(analyzer, loc, ty_idx) { Some(v) => v, None => { diff --git a/crates/solc-expressions/src/func_call/intrinsic_call/precompile.rs b/crates/solc-expressions/src/func_call/intrinsic_call/precompile.rs index 7dcd2249..9c6908a0 100644 --- a/crates/solc-expressions/src/func_call/intrinsic_call/precompile.rs +++ b/crates/solc-expressions/src/func_call/intrinsic_call/precompile.rs @@ -35,7 +35,7 @@ pub trait PrecompileCaller: match &*func_name { "sha256" => { self.parse_ctx_expr(arena, &input_exprs.unnamed_args().unwrap()[0], ctx)?; - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(input) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs( loc, @@ -60,7 +60,7 @@ pub trait PrecompileCaller: } "ripemd160" => { self.parse_ctx_expr(arena, &input_exprs.unnamed_args().unwrap()[0], ctx)?; - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(input) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs( loc, @@ -85,7 +85,7 @@ pub trait PrecompileCaller: } "ecrecover" => { input_exprs.parse(arena, self, ctx, loc)?; - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let cctx = Context::new_subctx( ctx, None, diff --git a/crates/solc-expressions/src/func_call/intrinsic_call/solidity.rs b/crates/solc-expressions/src/func_call/intrinsic_call/solidity.rs index 056e3ca0..0cb1f277 100644 --- a/crates/solc-expressions/src/func_call/intrinsic_call/solidity.rs +++ b/crates/solc-expressions/src/func_call/intrinsic_call/solidity.rs @@ -82,7 +82,7 @@ pub trait SolidityCaller: // TODO: actually calcuate this if possible input_exprs.parse(arena, self, ctx, loc)?; - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)?; let var = ContextVar::new_from_builtin( loc, @@ -99,7 +99,7 @@ pub trait SolidityCaller: "mulmod" => { // TODO: actually calcuate this if possible input_exprs.parse(arena, self, ctx, loc)?; - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)?; let var = ContextVar::new_from_builtin( loc, diff --git a/crates/solc-expressions/src/func_call/namespaced_call.rs b/crates/solc-expressions/src/func_call/namespaced_call.rs index a4c989e7..af229b61 100644 --- a/crates/solc-expressions/src/func_call/namespaced_call.rs +++ b/crates/solc-expressions/src/func_call/namespaced_call.rs @@ -310,7 +310,7 @@ pub trait NameSpaceFuncCaller: let _ = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)?; Ok(()) })?; - analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, _loc| { + analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, _loc| { ctx.push_expr(ExprRet::Single(cvar), analyzer) .into_expr_err(loc)?; Ok(()) diff --git a/crates/solc-expressions/src/list.rs b/crates/solc-expressions/src/list.rs index ef19a590..263dad5c 100644 --- a/crates/solc-expressions/src/list.rs +++ b/crates/solc-expressions/src/list.rs @@ -23,7 +23,7 @@ pub trait List: AnalyzerBackend + Sized { params.iter().try_for_each(|(loc, input)| { if let Some(input) = input { self.parse_ctx_expr(arena, &input.ty, ctx)?; - self.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoLhs( loc, @@ -39,13 +39,13 @@ pub trait List: AnalyzerBackend + Sized { }) } else { // create a dummy var - self.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, loc| { ctx.append_tmp_expr(ExprRet::Null, analyzer) .into_expr_err(loc) }) } })?; - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_tmp_expr(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoLhs( loc, diff --git a/crates/solc-expressions/src/member_access/member_trait.rs b/crates/solc-expressions/src/member_access/member_trait.rs index ab26fe1b..d266afeb 100644 --- a/crates/solc-expressions/src/member_access/member_trait.rs +++ b/crates/solc-expressions/src/member_access/member_trait.rs @@ -51,7 +51,7 @@ pub trait MemberAccess: } self.parse_ctx_expr(arena, member_expr, ctx)?; - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoLhs( loc, diff --git a/crates/solc-expressions/src/variable.rs b/crates/solc-expressions/src/variable.rs index d7d774ee..daa8cda5 100644 --- a/crates/solc-expressions/src/variable.rs +++ b/crates/solc-expressions/src/variable.rs @@ -40,7 +40,7 @@ pub trait Variable: AnalyzerBackend + Size target_ctx, ident.loc, arena, - &|analyzer, arena, edge_ctx, _loc| { + &|analyzer, _arena, edge_ctx, _loc| { let var = analyzer.advance_var_in_ctx(cvar, ident.loc, edge_ctx)?; edge_ctx .push_expr(ExprRet::Single(var.into()), analyzer) @@ -60,7 +60,7 @@ pub trait Variable: AnalyzerBackend + Size target_ctx, ident.loc, arena, - &|analyzer, arena, edge_ctx, _loc| { + &|analyzer, _arena, edge_ctx, _loc| { let var = analyzer.advance_var_in_ctx(cvar, ident.loc, edge_ctx)?; edge_ctx .push_expr(ExprRet::Single(var.into()), analyzer) diff --git a/crates/solc-expressions/src/yul/yul_builder.rs b/crates/solc-expressions/src/yul/yul_builder.rs index 7383337e..b878b7e8 100644 --- a/crates/solc-expressions/src/yul/yul_builder.rs +++ b/crates/solc-expressions/src/yul/yul_builder.rs @@ -155,7 +155,7 @@ pub trait YulBuilder: if let Some(yul_expr) = maybe_yul_expr { analyzer.parse_ctx_yul_expr(arena, yul_expr, ctx)?; - analyzer.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, loc| { + analyzer.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { @@ -312,7 +312,7 @@ pub trait YulBuilder: StringLiteral(lit, _) => self.string_literal(ctx, lit.loc, &lit.string), Variable(ident) => { self.variable(arena, ident, ctx, None)?; - self.apply_to_edges(ctx, ident.loc, arena, &|analyzer, arena, edge_ctx, loc| { + self.apply_to_edges(ctx, ident.loc, arena, &|analyzer, _arena, edge_ctx, loc| { if let Some(ret) = edge_ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? { if ContextVarNode::from(ret.expect_single().into_expr_err(loc)?) .is_memory(analyzer) @@ -345,7 +345,7 @@ pub trait YulBuilder: SuffixAccess(loc, yul_member_expr, ident) => { self.parse_inputs(arena, ctx, *loc, &[*yul_member_expr.clone()])?; - self.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, loc| { let Ok(Some(lhs)) = ctx.pop_expr_latest(loc, analyzer) else { return Err(ExprErr::NoLhs( loc, diff --git a/crates/solc-expressions/src/yul/yul_funcs.rs b/crates/solc-expressions/src/yul/yul_funcs.rs index 6702fb51..faf389d7 100644 --- a/crates/solc-expressions/src/yul/yul_funcs.rs +++ b/crates/solc-expressions/src/yul/yul_funcs.rs @@ -80,7 +80,7 @@ pub trait YulFuncCaller: return Ok(()); } analyzer.parse_ctx_yul_expr(arena, &arguments[1], ctx)?; - analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + analyzer.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(size) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoLhs(loc, "Yul Return had no size".to_string())); @@ -361,7 +361,7 @@ pub trait YulFuncCaller: } self.parse_ctx_yul_expr(arena, &arguments[0], ctx)?; - self.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, loc| { let Some(lhs_paths) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs( @@ -544,7 +544,7 @@ pub trait YulFuncCaller: } "balance" => { self.parse_ctx_yul_expr(arena, &arguments[0], ctx)?; - self.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, loc| { let Some(lhs_paths) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs( @@ -592,7 +592,7 @@ pub trait YulFuncCaller: } "extcodesize" => { self.parse_ctx_yul_expr(arena, &arguments[0], ctx)?; - self.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, loc| { let Some(lhs_paths) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs( @@ -641,7 +641,7 @@ pub trait YulFuncCaller: } self.parse_inputs(arena, ctx, *loc, arguments)?; - self.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, loc| { let Some(_lhs_paths) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs( @@ -666,7 +666,7 @@ pub trait YulFuncCaller: } self.parse_inputs(arena, ctx, *loc, arguments)?; - self.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, loc| { let Some(_lhs_paths) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs( @@ -680,7 +680,7 @@ pub trait YulFuncCaller: } "extcodehash" => { self.parse_ctx_yul_expr(arena, &arguments[0], ctx)?; - self.apply_to_edges(ctx, *loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, *loc, arena, &|analyzer, _arena, ctx, loc| { let Some(lhs_paths) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoRhs( @@ -775,7 +775,7 @@ pub trait YulFuncCaller: inputs.iter().try_for_each(|input| { self.parse_ctx_yul_expr(arena, input, ctx)?; - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoLhs( loc, @@ -795,7 +795,7 @@ pub trait YulFuncCaller: }) })?; if !inputs.is_empty() { - self.apply_to_edges(ctx, loc, arena, &|analyzer, arena, ctx, loc| { + self.apply_to_edges(ctx, loc, arena, &|analyzer, _arena, ctx, loc| { let Some(ret) = ctx.pop_tmp_expr(loc, analyzer).into_expr_err(loc)? else { return Err(ExprErr::NoLhs( loc,