Skip to content

Commit 39b89cb

Browse files
committed
Fix some formatting
1 parent f0c3374 commit 39b89cb

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

src/biguint.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,12 +2736,10 @@ impl BigUint {
27362736
self.data.resize(digit_index + 1, 0);
27372737
}
27382738
self.data[digit_index] |= bit_mask;
2739-
} else {
2740-
if digit_index < self.data.len() {
2741-
self.data[digit_index] &= !bit_mask;
2742-
// the top bit may have been cleared, so normalize
2743-
self.normalize();
2744-
}
2739+
} else if digit_index < self.data.len() {
2740+
self.data[digit_index] &= !bit_mask;
2741+
// the top bit may have been cleared, so normalize
2742+
self.normalize();
27452743
}
27462744
}
27472745
}

tests/bigint.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,15 +1342,27 @@ fn test_set_bit() {
13421342
x.set_bit(200, true);
13431343
assert_eq!(x, BigInt::from(-12i8));
13441344
x.set_bit(200, false);
1345-
assert_eq!(x, BigInt::from_biguint(Minus, BigUint::from(12u8) | (BigUint::one() << 200)));
1345+
assert_eq!(
1346+
x,
1347+
BigInt::from_biguint(Minus, BigUint::from(12u8) | (BigUint::one() << 200))
1348+
);
13461349
x.set_bit(6, false);
1347-
assert_eq!(x, BigInt::from_biguint(Minus, BigUint::from(76u8) | (BigUint::one() << 200)));
1350+
assert_eq!(
1351+
x,
1352+
BigInt::from_biguint(Minus, BigUint::from(76u8) | (BigUint::one() << 200))
1353+
);
13481354
x.set_bit(6, true);
1349-
assert_eq!(x, BigInt::from_biguint(Minus, BigUint::from(12u8) | (BigUint::one() << 200)));
1355+
assert_eq!(
1356+
x,
1357+
BigInt::from_biguint(Minus, BigUint::from(12u8) | (BigUint::one() << 200))
1358+
);
13501359
x.set_bit(200, true);
13511360
assert_eq!(x, BigInt::from(-12i8));
13521361

13531362
x = BigInt::from_biguint(Minus, BigUint::one() << 200);
13541363
x.set_bit(40, true);
1355-
assert_eq!(x, BigInt::from_biguint(Minus, (BigUint::one() << 200) - (BigUint::one() << 40)));
1364+
assert_eq!(
1365+
x,
1366+
BigInt::from_biguint(Minus, (BigUint::one() << 200) - (BigUint::one() << 40))
1367+
);
13561368
}

0 commit comments

Comments
 (0)