Skip to content

Commit

Permalink
Make clippy satisfy
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Nak committed Dec 12, 2022
1 parent f594b6b commit 872f565
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
10 changes: 9 additions & 1 deletion crates/codegen/src/cgu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use indexmap::IndexMap;

use crate::db::CodegenDb;

#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, Eq)]
pub struct CodegenUnit {
pub module: ModuleId,

Expand All @@ -33,6 +33,14 @@ impl CodegenUnit {
}
}

impl PartialEq for CodegenUnit {
fn eq(&self, other: &Self) -> bool {
self.module == other.module
&& self.contracts == other.contracts
&& self.functions == other.functions
}
}

impl Hash for CodegenUnit {
fn hash<H: Hasher>(&self, state: &mut H) {
self.module.hash(state);
Expand Down
5 changes: 1 addition & 4 deletions crates/codegen/src/db/queries/cgu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,7 @@ impl<'db> CguFunctionBuilder<'db> {
.iter()
.map(|param| {
let ty = match &param.ty.data(self.db.upcast()).kind {
TypeKind::TypeParam(def) => {
let ty = substs[&def.name];
ty
}
TypeKind::TypeParam(def) => substs[&def.name],
_ => param.ty,
};

Expand Down
4 changes: 2 additions & 2 deletions crates/codegen/src/yul/dependency_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ impl DependencyGraph {
..
} => {
self.update_graph_by_func(db, cgus, *callee);
let callee_node = self.func_node_map[&callee];
let callee_node = self.func_node_map[callee];
self.dep_graph.update_edge(func_node, callee_node, ());
}

InstKind::Create { contract, .. } | InstKind::Create2 { contract, .. } => {
self.update_graph_by_contract(db, cgus, *contract);
let contract_node = self.contract_node_map[&contract];
let contract_node = self.contract_node_map[contract];
self.dep_graph
.update_edge(self.contract_scope.unwrap(), contract_node, ());
self.dep_graph.update_edge(func_node, contract_node, ());
Expand Down
2 changes: 1 addition & 1 deletion crates/codegen/src/yul/isel/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub(crate) fn lower_function(
let sig_data = &db.codegen_legalized_signature(func.sig);
let body = &mut func.body;
legalize_func_body(db, body);
FuncLowerHelper::new(db, ctx, func.sig, sig_data, &body).lower_func()
FuncLowerHelper::new(db, ctx, func.sig, sig_data, body).lower_func()
}

struct FuncLowerHelper<'db, 'a> {
Expand Down

0 comments on commit 872f565

Please sign in to comment.