Skip to content

Commit

Permalink
Merge pull request #323 from Pat-Lafon/clippy-1.78
Browse files Browse the repository at this point in the history
Clippy 1.78
  • Loading branch information
sampsyo authored May 17, 2024
2 parents 5401a00 + 0eb549d commit 45edbd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions bril-rs/rs2bril/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ impl State {
}

fn starting_new_function(&mut self, name: &String) {
self.ident_type_map = self.func_context_map.get(name).unwrap().0.clone();
self.ident_type_map
.clone_from(&self.func_context_map.get(name).unwrap().0);
}

fn add_type_for_ident(&mut self, ident: String, ty: Type) {
Expand Down Expand Up @@ -570,35 +571,35 @@ fn from_expr_to_bril(expr: Expr, state: &mut State) -> (Option<String>, Vec<Code
// So we need to set a specific destination
// https://doc.rust-lang.org/reference/expressions.html#place-expressions-and-value-expressions
(BinOp::AddAssign(_), Type::Int) => {
place_expression = arg1.clone();
place_expression.clone_from(&arg1);
(ValueOps::Add, Type::Int)
}
(BinOp::AddAssign(_), Type::Float) => {
place_expression = arg1.clone();
place_expression.clone_from(&arg1);
(ValueOps::Fadd, Type::Float)
}
(BinOp::SubAssign(_), Type::Int) => {
place_expression = arg1.clone();
place_expression.clone_from(&arg1);
(ValueOps::Sub, Type::Int)
}
(BinOp::SubAssign(_), Type::Float) => {
place_expression = arg1.clone();
place_expression.clone_from(&arg1);
(ValueOps::Fsub, Type::Float)
}
(BinOp::MulAssign(_), Type::Int) => {
place_expression = arg1.clone();
place_expression.clone_from(&arg1);
(ValueOps::Mul, Type::Int)
}
(BinOp::MulAssign(_), Type::Float) => {
place_expression = arg1.clone();
place_expression.clone_from(&arg1);
(ValueOps::Fmul, Type::Float)
}
(BinOp::DivAssign(_), Type::Int) => {
place_expression = arg1.clone();
place_expression.clone_from(&arg1);
(ValueOps::Div, Type::Int)
}
(BinOp::DivAssign(_), Type::Float) => {
place_expression = arg1.clone();
place_expression.clone_from(&arg1);
(ValueOps::Fdiv, Type::Float)
}
(_, _) => unimplemented!("{op:?}"),
Expand Down
2 changes: 1 addition & 1 deletion brilirs/src/basic_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl BBProgram {
.collect::<Result<Vec<BBFunction>, InterpError>>()?;

let bb = Self {
index_of_main: func_map.get(&"main".to_string()).copied(),
index_of_main: func_map.get("main").copied(),
func_index,
};
if func_map.len() == num_funcs {
Expand Down

0 comments on commit 45edbd3

Please sign in to comment.