diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2018-05-28 19:42:11 -0700 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2018-06-26 07:53:30 -0700 |
| commit | 057715557b51af125847da6d19b2e016283c5ae7 (patch) | |
| tree | dfe0cc5a807ac7ed47bb77893f1c69198be825f6 /src/libcore/fmt/num.rs | |
| parent | 764232cb2a8407c72b9fea68835e686240e30ef3 (diff) | |
| download | rust-057715557b51af125847da6d19b2e016283c5ae7.tar.gz rust-057715557b51af125847da6d19b2e016283c5ae7.zip | |
migrate codebase to `..=` inclusive range patterns
These were stabilized in March 2018's #47813, and are the Preferred Way to Do It going forward (q.v. #51043).
Diffstat (limited to 'src/libcore/fmt/num.rs')
| -rw-r--r-- | src/libcore/fmt/num.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 4451ab445cc..51391fa50d5 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -121,19 +121,19 @@ macro_rules! radix { fn digit(x: u8) -> u8 { match x { $($x => $conv,)+ - x => panic!("number not in the range 0..{}: {}", Self::BASE - 1, x), + x => panic!("number not in the range 0..={}: {}", Self::BASE - 1, x), } } } } } -radix! { Binary, 2, "0b", x @ 0 ... 1 => b'0' + x } -radix! { Octal, 8, "0o", x @ 0 ... 7 => b'0' + x } -radix! { LowerHex, 16, "0x", x @ 0 ... 9 => b'0' + x, - x @ 10 ... 15 => b'a' + (x - 10) } -radix! { UpperHex, 16, "0x", x @ 0 ... 9 => b'0' + x, - x @ 10 ... 15 => b'A' + (x - 10) } +radix! { Binary, 2, "0b", x @ 0 ..= 1 => b'0' + x } +radix! { Octal, 8, "0o", x @ 0 ..= 7 => b'0' + x } +radix! { LowerHex, 16, "0x", x @ 0 ..= 9 => b'0' + x, + x @ 10 ..= 15 => b'a' + (x - 10) } +radix! { UpperHex, 16, "0x", x @ 0 ..= 9 => b'0' + x, + x @ 10 ..= 15 => b'A' + (x - 10) } macro_rules! int_base { ($Trait:ident for $T:ident as $U:ident -> $Radix:ident) => { |
