Skip to content

Commit a1c4f69

Browse files
committed
lint & format
1 parent 1af5d01 commit a1c4f69

File tree

10 files changed

+21
-15
lines changed

10 files changed

+21
-15
lines changed

src/ir/opt/chall.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ pub fn deskolemize_witnesses(comp: &mut Computation) {
5454
if let Op::Witness(prefix) = orig.op() {
5555
let name = self.0.mk_uniq(prefix);
5656
let sort = check(orig);
57-
let var = computation.new_var(&name, sort, Some(PROVER_ID), Some(orig.cs()[0].clone()));
57+
let var =
58+
computation.new_var(&name, sort, Some(PROVER_ID), Some(orig.cs()[0].clone()));
5859
Some(var)
5960
} else {
6061
None

src/ir/opt/mem/obliv.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,9 @@ impl OblivRewriter {
125125
Op::Witness(s) => {
126126
let arg = &t.cs()[0];
127127
(
128-
if let Some(targ) = self.tups.get(arg) {
129-
Some(term![Op::Witness(s.clone()); targ.clone()])
130-
} else {
131-
None
132-
},
128+
self.tups
129+
.get(arg)
130+
.map(|targ| term![Op::Witness(s.clone()); targ.clone()]),
133131
None,
134132
)
135133
}

src/ir/opt/mem/ram/volatile.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ impl RewritePass for Extactor {
367367
.collect::<Vec<_>>(),
368368
cache.keys().cloned().collect(),
369369
) {
370+
// false positive: the value constructor uses `cache`.
371+
#[allow(clippy::map_entry)]
370372
if !cache.contains_key(&t) {
371373
let new_t = term(
372374
t.op().clone(),
@@ -378,7 +380,11 @@ impl RewritePass for Extactor {
378380
cache.insert(t, new_t);
379381
}
380382
}
381-
for (name, _sort) in computation.precomputes.sequence()[..initial_precompute_len].to_owned() {
383+
// false positive; need to clone to drop reference.
384+
#[allow(clippy::unnecessary_to_owned)]
385+
for (name, _sort) in
386+
computation.precomputes.sequence()[..initial_precompute_len].to_owned()
387+
{
382388
let term = computation.precomputes.outputs.get_mut(&name).unwrap();
383389
*term = cache.get(term).unwrap().clone();
384390
}

src/ir/opt/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub enum Opt {
6262
/// Run optimizations on `cs`, in this order, returning the new constraint system.
6363
pub fn opt<I: IntoIterator<Item = Opt>>(mut cs: Computations, optimizations: I) -> Computations {
6464
for c in cs.comps.values() {
65-
trace!("Before all opts: {}", text::serialize_computation(&c));
65+
trace!("Before all opts: {}", text::serialize_computation(c));
6666
}
6767
for i in optimizations {
6868
debug!("Applying: {:?}", i);
@@ -163,7 +163,7 @@ pub fn opt<I: IntoIterator<Item = Opt>>(mut cs: Computations, optimizations: I)
163163
}
164164
}
165165
debug!("After {:?}: {} outputs", i, c.outputs.len());
166-
trace!("After {:?}: {}", i, text::serialize_computation(&c));
166+
trace!("After {:?}: {}", i, text::serialize_computation(c));
167167
//debug!("After {:?}: {}", i, Letified(cs.outputs[0].clone()));
168168
debug!("After {:?}: {} terms", i, c.terms());
169169
#[cfg(debug_assertions)]

src/ir/opt/scalarize_vars.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl RewritePass for Pass {
120120
if !sort.is_scalar() {
121121
trace!("Considering witness: {}", name);
122122
}
123-
Some(create_wits(&name, cs.pop().unwrap(), &sort))
123+
Some(create_wits(name, cs.pop().unwrap(), &sort))
124124
} else {
125125
None
126126
}

src/ir/opt/tuple.rs

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ impl TupleTree {
149149
_ => panic!("{:?} is tuple!", self),
150150
}
151151
}
152+
#[allow(clippy::wrong_self_convention)]
152153
fn as_term(self) -> Term {
153154
match self {
154155
TupleTree::NonTuple(t) => t,

src/ir/term/ext.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use circ_hc::Node;
66
use serde::{Deserialize, Serialize};
77

88
mod haboeck;
9-
mod pf_batch_inv;
109
mod map;
10+
mod pf_batch_inv;
1111
mod poly;
1212
mod ram;
1313
mod sort;

src/ir/term/ext/ram.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn check(arg_sorts: &[&Sort]) -> Result<Sort, TypeErrorReason> {
99
let &[entries, indices] = ty::count_or_ref(arg_sorts)?;
1010
let (size, value) = ty::homogenous_tuple_or(entries, "PersistentRamSplit entries")?;
1111
let [old, new] = ty::count_or(ty::tuple_or(value, "PersistentRamSplit entries")?)?;
12-
eq_or(&old, &new, "PersistentRamSplit entries")?;
12+
eq_or(old, new, "PersistentRamSplit entries")?;
1313
let (i_size, i_value) = ty::homogenous_tuple_or(indices, "PersistentRamSplit indices")?;
1414
let f = pf_or(i_value, "PersistentRamSplit indices")?;
1515
let n_touched = i_size.min(size);

src/ir/term/extras.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ pub fn node_cs_iter(node: Term) -> impl Iterator<Item = Term> {
277277
// /// Any extra dependencies that should be traversed before this term.
278278
// fn extra_dependencies(&mut self, t: &Term) -> Option<Vec<Term>> { None }
279279
// }
280-
//
280+
//
281281
// pub struct TermTraversal {
282-
//
282+
//
283283
// }

src/ir/term/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ pub(super) fn homogenous_tuple_or<'a>(
687687
ctx: &'static str,
688688
) -> Result<(usize, &'a Sort), TypeErrorReason> {
689689
let sorts = tuple_or(a, ctx)?;
690-
if sorts.len() > 0 {
690+
if !sorts.is_empty() {
691691
for i in 1..sorts.len() {
692692
if sorts[0] != sorts[i] {
693693
return Err(TypeErrorReason::ExpectedHomogenousTuple(ctx));

0 commit comments

Comments
 (0)