| 1 | pub(craterust-analyzer cargo formatx 0.2.4 crate/) fn is_numberrust-analyzer cargo formatx 0.2.4 utils/is_number().(text: &str) -> bool { |
| 2 | text.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<usize>().is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() || text.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<isize>().is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() || text.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<f64>().is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() |
| 3 | } |
| 4 | |
| 5 | pub(craterust-analyzer cargo formatx 0.2.4 crate/) fn is_number_and_positiverust-analyzer cargo formatx 0.2.4 utils/is_number_and_positive().(text: &str) -> bool { |
| 6 | if text.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<usize>().is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() { |
| 7 | true |
| 8 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(num) = text.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<isize>() { |
| 9 | num.is_positiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[isize]is_positive().() |
| 10 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(num) = text.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<f64>() { |
| 11 | num.is_sign_positiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]is_sign_positive().() |
| 12 | } else { |
| 13 | false |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | pub(craterust-analyzer cargo formatx 0.2.4 crate/) fn usize_tokenrust-analyzer cargo formatx 0.2.4 utils/usize_token().(spec: &str, match_index: usize) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize> { |
| 18 | let mut token = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 19 | let mut token_index = match_index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1; |
| 20 | |
| 21 | while let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(token_suffixed) = spec |
| 22 | .getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]get().(match_index..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#token_index) |
| 23 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().("null") |
| 24 | .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<usize>() |
| 25 | { |
| 26 | token = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(token_suffixed); |
| 27 | token_index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 28 | } |
| 29 | |
| 30 | token |
| 31 | } |