File tree 2 files changed +2
-4
lines changed 2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,7 @@ impl Num for BigInt {
25
25
/// Creates and initializes a [`BigInt`].
26
26
#[ inline]
27
27
fn from_str_radix ( mut s : & str , radix : u32 ) -> Result < BigInt , ParseBigIntError > {
28
- let sign = if s. starts_with ( '-' ) {
29
- let tail = & s[ 1 ..] ;
28
+ let sign = if let Some ( tail) = s. strip_prefix ( '-' ) {
30
29
if !tail. starts_with ( '+' ) {
31
30
s = tail
32
31
}
Original file line number Diff line number Diff line change @@ -221,8 +221,7 @@ impl Num for BigUint {
221
221
fn from_str_radix ( s : & str , radix : u32 ) -> Result < BigUint , ParseBigIntError > {
222
222
assert ! ( 2 <= radix && radix <= 36 , "The radix must be within 2...36" ) ;
223
223
let mut s = s;
224
- if s. starts_with ( '+' ) {
225
- let tail = & s[ 1 ..] ;
224
+ if let Some ( tail) = s. strip_prefix ( '+' ) {
226
225
if !tail. starts_with ( '+' ) {
227
226
s = tail
228
227
}
You can’t perform that action at this time.
0 commit comments