Skip to content

Commit da3cad9

Browse files
authored
Merge pull request aylei#10 from yue2388253/master
'...' range patterns are deprecated, fix it
2 parents c6d2e23 + 18041a2 commit da3cad9

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/n0008_string_to_integer_atoi.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl Solution {
7474
if !num_matched {
7575
match ch {
7676
' ' => {},
77-
'0'...'9' => {
77+
'0'..='9' => {
7878
num_matched = true;
7979
result = result * 10 + ch.to_digit(10).unwrap() as i64;
8080
},
@@ -84,7 +84,7 @@ impl Solution {
8484
}
8585
} else {
8686
match ch {
87-
'0'...'9' => {
87+
'0'..='9' => {
8888
result = result * 10 + ch.to_digit(10).unwrap() as i64;
8989
if result > i32_max { break }
9090
},

src/n0224_basic_calculator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl Solution {
5252
let mut in_num = false;
5353
for ch in s.chars() {
5454
match ch {
55-
'0'...'9' => {
55+
'0'..='9' => {
5656
in_num = true;
5757
num = 10 * num + (ch as u8 - '0' as u8) as i64;
5858
}

src/n0227_basic_calculator_ii.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Solution {
4747
let mut multiple = true;
4848
for ch in s.chars() {
4949
match ch {
50-
'0'...'9' => { curr = 10 * curr + (ch as u8 - '0' as u8) as i64; },
50+
'0'..='9' => { curr = 10 * curr + (ch as u8 - '0' as u8) as i64; },
5151
'+' | '-' => {
5252
if has_prev {
5353
if multiple {

0 commit comments

Comments
 (0)