-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
//! Integer and floating-point number formatting
#![allow(deprecated)]
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) => {