about summary refs log tree commit diff
path: root/src/libcore/unicode/printable.py
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-11-30 16:56:55 +0100
committerGitHub <noreply@github.com>2019-11-30 16:56:55 +0100
commit2e83c6d114dcf49c93dbd7fbaa9ca3d8b67c54e8 (patch)
tree41142e0088cbbcfc968da5e6dc5577b817f74e5e /src/libcore/unicode/printable.py
parentc85f63561e1224cec657bcf1a51d78e762f628e5 (diff)
parent28eb31f8dcfa495e2d0090a7e649d90a2cbef237 (diff)
downloadrust-2e83c6d114dcf49c93dbd7fbaa9ca3d8b67c54e8.tar.gz
rust-2e83c6d114dcf49c93dbd7fbaa9ca3d8b67c54e8.zip
Rollup merge of #66889 - dtolnay:fmt6, r=rkruppe
Make python-generated source files compatible with rustfmt

This PR adjusts the generators for src/libcore/num/dec2flt/table.rs, src/libcore/unicode/printable.rs, and src/libcore/unicode/tables.rs to make it so running `rustfmt` on the generated files no longer needs to apply any changes.

This involves tweaking the python scripts where reasonable to better match rustfmt's style, and adding `#[rustfmt::skip]` to big constant tables that there's no point having rustfmt rewrap.

r? @Dylan-DPC
Diffstat (limited to 'src/libcore/unicode/printable.py')
-rwxr-xr-x[-rw-r--r--]src/libcore/unicode/printable.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libcore/unicode/printable.py b/src/libcore/unicode/printable.py
index 4e8b4ecad02..91db6381c9b 100644..100755
--- 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 {