Skip to content

Commit 029d04d

Browse files
committed
Simplify TryFrom a little bit
1 parent 0da7ae7 commit 029d04d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/bigint.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,9 +2715,7 @@ impl TryFrom<&BigInt> for BigUint {
27152715

27162716
#[inline]
27172717
fn try_from(value: &BigInt) -> Result<BigUint, TryFromBigIntError<()>> {
2718-
value
2719-
.to_biguint()
2720-
.ok_or_else(|| TryFromBigIntError::new(()))
2718+
value.to_biguint().ok_or(TryFromBigIntError::new(()))
27212719
}
27222720
}
27232721

@@ -2730,8 +2728,7 @@ impl TryFrom<BigInt> for BigUint {
27302728
if value.sign() == Sign::Minus {
27312729
Err(TryFromBigIntError::new(value))
27322730
} else {
2733-
let (_, biguint) = value.into_parts();
2734-
Ok(biguint)
2731+
Ok(value.data)
27352732
}
27362733
}
27372734
}

0 commit comments

Comments
 (0)