Make libcore/unicode/printable.rs compatible with rustfmt

This commit is contained in:
David Tolnay 2019-11-29 19:44:55 -08:00
parent d353a4c267
commit f4cff27792
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 11 additions and 4 deletions

6
src/libcore/unicode/printable.py Normal file → Executable file
View File

@ -111,16 +111,19 @@ def compress_normal(normal):
return compressed
def print_singletons(uppers, lowers, uppersname, lowersname):
print("#[rustfmt::skip]")
print("const {}: &[(u8, u8)] = &[".format(uppersname))
for u, c in uppers:
print(" ({:#04x}, {}),".format(u, c))
print("];")
print("#[rustfmt::skip]")
print("const {}: &[u8] = &[".format(lowersname))
for i in range(0, len(lowers), 8):
print(" {}".format(" ".join("{:#04x},".format(l) for l in lowers[i:i+8])))
print("];")
def print_normal(normal, normalname):
print("#[rustfmt::skip]")
print("const {}: &[u8] = &[".format(normalname))
for v in normal:
print(" {}".format(" ".join("{:#04x},".format(i) for i in v)))
@ -170,8 +173,7 @@ def main():
// NOTE: The following code was generated by "src/libcore/unicode/printable.py",
// do not edit directly!
fn check(x: u16, singletonuppers: &[(u8, u8)], singletonlowers: &[u8],
normal: &[u8]) -> bool {
fn check(x: u16, singletonuppers: &[(u8, u8)], singletonlowers: &[u8], normal: &[u8]) -> bool {
let xupper = (x >> 8) as u8;
let mut lowerstart = 0;
for &(upper, lowercount) in singletonuppers {

View File

@ -1,8 +1,7 @@
// NOTE: The following code was generated by "src/libcore/unicode/printable.py",
// do not edit directly!
fn check(x: u16, singletonuppers: &[(u8, u8)], singletonlowers: &[u8],
normal: &[u8]) -> bool {
fn check(x: u16, singletonuppers: &[(u8, u8)], singletonlowers: &[u8], normal: &[u8]) -> bool {
let xupper = (x >> 8) as u8;
let mut lowerstart = 0;
for &(upper, lowercount) in singletonuppers {
@ -70,6 +69,7 @@ pub(crate) fn is_printable(x: char) -> bool {
}
}
#[rustfmt::skip]
const SINGLETONS0U: &[(u8, u8)] = &[
(0x00, 1),
(0x03, 5),
@ -113,6 +113,7 @@ const SINGLETONS0U: &[(u8, u8)] = &[
(0xfe, 3),
(0xff, 9),
];
#[rustfmt::skip]
const SINGLETONS0L: &[u8] = &[
0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57,
0x58, 0x8b, 0x8c, 0x90, 0x1c, 0x1d, 0xdd, 0x0e,
@ -152,6 +153,7 @@ const SINGLETONS0L: &[u8] = &[
0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9, 0xd0, 0xd1,
0xd8, 0xd9, 0xe7, 0xfe, 0xff,
];
#[rustfmt::skip]
const SINGLETONS1U: &[(u8, u8)] = &[
(0x00, 6),
(0x01, 1),
@ -189,6 +191,7 @@ const SINGLETONS1U: &[(u8, u8)] = &[
(0xf9, 6),
(0xfa, 2),
];
#[rustfmt::skip]
const SINGLETONS1L: &[u8] = &[
0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e,
0x9e, 0x9f, 0x06, 0x07, 0x09, 0x36, 0x3d, 0x3e,
@ -212,6 +215,7 @@ const SINGLETONS1L: &[u8] = &[
0xa4, 0xaa, 0xaf, 0xb0, 0xc0, 0xd0, 0x0c, 0x72,
0xa3, 0xa4, 0xcb, 0xcc, 0x6e, 0x6f,
];
#[rustfmt::skip]
const NORMAL0: &[u8] = &[
0x00, 0x20,
0x5f, 0x22,
@ -355,6 +359,7 @@ const NORMAL0: &[u8] = &[
0x1b, 0x03,
0x0f, 0x0d,
];
#[rustfmt::skip]
const NORMAL1: &[u8] = &[
0x5e, 0x22,
0x7b, 0x05,