File tree Expand file tree Collapse file tree 2 files changed +2
-4
lines changed
Expand file tree Collapse file tree 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 {
2525 /// Creates and initializes a [`BigInt`].
2626 #[ inline]
2727 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 ( '-' ) {
3029 if !tail. starts_with ( '+' ) {
3130 s = tail
3231 }
Original file line number Diff line number Diff line change @@ -221,8 +221,7 @@ impl Num for BigUint {
221221 fn from_str_radix ( s : & str , radix : u32 ) -> Result < BigUint , ParseBigIntError > {
222222 assert ! ( 2 <= radix && radix <= 36 , "The radix must be within 2...36" ) ;
223223 let mut s = s;
224- if s. starts_with ( '+' ) {
225- let tail = & s[ 1 ..] ;
224+ if let Some ( tail) = s. strip_prefix ( '+' ) {
226225 if !tail. starts_with ( '+' ) {
227226 s = tail
228227 }
You can’t perform that action at this time.
0 commit comments