Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanosChaliasos committed Oct 30, 2024
1 parent cdbc804 commit 1121700
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 26 deletions.
7 changes: 3 additions & 4 deletions src/front/c/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,12 +1134,11 @@ impl CGen {
}
};
}
Statement::Expression(expr) => match expr {
Some(e) => {
Statement::Expression(expr) => {
if let Some(e) = expr {
self.gen_expr(&e.node);
}
None => {}
},
}
Statement::For(for_stmt) => {
// TODO: Add enter_breakable
self.circ_enter_scope();
Expand Down
35 changes: 15 additions & 20 deletions src/front/zsharpcurly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl<'ast> ZGen<'ast> {
args.len(),
f_name
))
} else if generics.len() != 0 {
} else if !generics.is_empty() {
Err(format!(
"Got {} generic args to EMBED/{}, expected 0",
generics.len(),
Expand All @@ -282,7 +282,7 @@ impl<'ast> ZGen<'ast> {
args.len(),
f_name
))
} else if generics.len() != 0 {
} else if !generics.is_empty() {
Err(format!(
"Got {} generic args to EMBED/{}, expected 0",
generics.len(),
Expand Down Expand Up @@ -830,7 +830,7 @@ impl<'ast> ZGen<'ast> {
.unify_generic(egv, exp_ty, arg_tys)?;

let mut generic_vec = generics.clone().into_iter().collect::<Vec<_>>();
generic_vec.sort_by(|(a, _), (b, _)| a.cmp(&b));
generic_vec.sort_by(|(a, _), (b, _)| a.cmp(b));
let before = time::Instant::now();

let input = FnCallImplInput(
Expand Down Expand Up @@ -1129,23 +1129,18 @@ impl<'ast> ZGen<'ast> {
.push(cmp);
}
}
} else {
match self.mode {
Mode::Proof => {
// set ret_eq to true
let ret_eq = term![Op::Const(Box::new(Value::Bool(true)))];
let mut assertions = std::mem::take(&mut *self.assertions.borrow_mut());
let to_assert = if assertions.is_empty() {
ret_eq
} else {
assertions.push(ret_eq);
term(AND, assertions)
};
debug!("Assertion: {}", to_assert);
self.circ.borrow_mut().assert(to_assert);
}
_ => {}
}
} else if let Mode::Proof = self.mode {
// set ret_eq to true
let ret_eq = term![Op::Const(Box::new(Value::Bool(true)))];
let mut assertions = std::mem::take(&mut *self.assertions.borrow_mut());
let to_assert = if assertions.is_empty() {
ret_eq
} else {
assertions.push(ret_eq);
term(AND, assertions)
};
debug!("Assertion: {}", to_assert);
self.circ.borrow_mut().assert(to_assert);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/front/zsharpcurly/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ pub fn const_bool(a: T) -> Option<bool> {

pub fn const_fold(t: T) -> T {
let folded = constant_fold(&t.term, &[]);
return T::new(t.ty, folded);
T::new(t.ty, folded)
}

pub fn const_val(a: T) -> Result<T, String> {
Expand Down Expand Up @@ -1266,7 +1266,7 @@ impl Embeddable for ZSharp {
term(
Op::Tuple,
tys.iter()
.zip(ps.into_iter())
.zip(ps)
.enumerate()
.map(|(i, (ty, p))| {
self.declare_input(
Expand Down

0 comments on commit 1121700

Please sign in to comment.