From f4cff277925d61c15e64cc2a05b37a3446a3a411 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 29 Nov 2019 19:44:55 -0800 Subject: [PATCH] Make libcore/unicode/printable.rs compatible with rustfmt --- src/libcore/unicode/printable.py | 6 ++++-- src/libcore/unicode/printable.rs | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/libcore/unicode/printable.py diff --git a/src/libcore/unicode/printable.py b/src/libcore/unicode/printable.py old mode 100644 new mode 100755 index 4e8b4ecad02..91db6381c9b --- a/src/libcore/unicode/printable.py +++ b/src/libcore/unicode/printable.py @@ -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 { diff --git a/src/libcore/unicode/printable.rs b/src/libcore/unicode/printable.rs index d411dda7dc1..eee9ea52ef0 100644 --- a/src/libcore/unicode/printable.rs +++ b/src/libcore/unicode/printable.rs @@ -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,