Skip to content

Commit

Permalink
Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zhassan-aws committed Dec 19, 2023
1 parent 9b3b12e commit 39f7024
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion boogie_ast/src/boogie_program/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ impl Expr {
Expr::FunctionCall { symbol, arguments }
}

pub fn sign_extend(_e: Box<Expr>, _width: usize) -> Self {
pub fn sign_extend(e: Box<Expr>, _width: usize) -> Self {
let _e = e;
todo!()
}

Expand Down
13 changes: 6 additions & 7 deletions kani-compiler/src/codegen_boogie/context/boogie_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT

use itertools::Itertools;
use std::cmp::Ordering;
use std::io::Write;

use crate::kani_queries::QueryDb;
Expand Down Expand Up @@ -329,16 +330,14 @@ impl<'a, 'tcx> FunctionCtx<'a, 'tcx> {
let to = self.codegen_type(*ty);
let Type::Bv(from_width) = from else { panic!("Expecting bv type in cast") };
let Type::Bv(to_width) = to else { panic!("Expecting bv type in cast") };
let op = if from_width > to_width {
Expr::extract(Box::new(o), to_width, 0)
} else if from_width < to_width {
match from_type.kind() {
let op = match from_width.cmp(&to_width) {
Ordering::Greater => Expr::extract(Box::new(o), to_width, 0),
Ordering::Less => match from_type.kind() {
ty::Int(_) => Expr::sign_extend(Box::new(o), to_width - from_width),
ty::Uint(_) => Expr::zero_extend(Box::new(o), to_width - from_width),
_ => todo!(),
}
} else {
o
},
Ordering::Equal => o,
};
(None, op)
} else {
Expand Down

0 comments on commit 39f7024

Please sign in to comment.