Skip to content

Commit da1f304

Browse files
committed
Fix clippy warnings
1 parent 2ddcb0a commit da1f304

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/circuit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ impl CircuitBuilder {
12411241
fn unsigned_as_usize_bits(n: u64) -> [usize; USIZE_BITS] {
12421242
let mut bits = [0; USIZE_BITS];
12431243
for (i, bit) in bits.iter_mut().enumerate().take(USIZE_BITS) {
1244-
*bit = (n >> (USIZE_BITS - 1 - i) & 1) as usize;
1244+
*bit = ((n >> (USIZE_BITS - 1 - i)) & 1) as usize;
12451245
}
12461246
bits
12471247
}

src/compile.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1386,13 +1386,13 @@ pub(crate) fn enum_max_size(
13861386

13871387
pub(crate) fn unsigned_to_bits(n: u64, size: usize, bits: &mut Vec<bool>) {
13881388
for i in 0..size {
1389-
bits.push((n >> (size - 1 - i) & 1) == 1);
1389+
bits.push(((n >> (size - 1 - i)) & 1) == 1);
13901390
}
13911391
}
13921392

13931393
pub(crate) fn signed_to_bits(n: i64, size: usize, bits: &mut Vec<bool>) {
13941394
for i in 0..size {
1395-
bits.push((n >> (size - 1 - i) & 1) == 1);
1395+
bits.push(((n >> (size - 1 - i)) & 1) == 1);
13961396
}
13971397
}
13981398

tests/compile.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ pub fn main(x: i16, y: i16) -> bool {
430430
for x in -10..10 {
431431
for y in -10..10 {
432432
let mut eval = compiled.evaluator();
433-
let expected = (x > y) && (y < x);
433+
let expected = x > y;
434434
eval.set_i16(x);
435435
eval.set_i16(y);
436436
let output = eval.run().map_err(|e| pretty_print(e, prg))?;
@@ -1840,17 +1840,17 @@ pub fn main(a: bool, b: bool, c: bool) -> bool {
18401840
(a & b) | (a & c)
18411841
}
18421842
";
1843-
let compiled = compile(&prg).map_err(|e| pretty_print(e, &prg))?;
1843+
let compiled = compile(prg).map_err(|e| pretty_print(e, prg))?;
18441844
for a in [true, false] {
18451845
for b in [true, false] {
18461846
for c in [true, false] {
18471847
let mut eval = compiled.evaluator();
18481848
eval.set_bool(a);
18491849
eval.set_bool(b);
18501850
eval.set_bool(c);
1851-
let output = eval.run().map_err(|e| pretty_print(e, &prg))?;
1851+
let output = eval.run().map_err(|e| pretty_print(e, prg))?;
18521852
assert_eq!(
1853-
bool::try_from(output).map_err(|e| pretty_print(e, &prg))?,
1853+
bool::try_from(output).map_err(|e| pretty_print(e, prg))?,
18541854
(a & b) | (a & c),
18551855
"({a} & {b}) | ({a} & {c})"
18561856
);

0 commit comments

Comments
 (0)