diff options
| author | Karl Meakin <karl.meakin@arm.com> | 2025-08-09 23:52:11 +0100 |
|---|---|---|
| committer | Karl Meakin <karl.meakin@arm.com> | 2025-08-15 01:29:12 +0000 |
| commit | c99224536152cff14639b64a3fa4f7a215fd037c (patch) | |
| tree | 2ce7f3921d001507020f4fc0e9405261bb6c1d97 /src/tools | |
| parent | 898aff704d6f0d00343f21d31b8b9bfac8e43007 (diff) | |
| download | rust-c99224536152cff14639b64a3fa4f7a215fd037c.tar.gz rust-c99224536152cff14639b64a3fa4f7a215fd037c.zip | |
refactor: Include table sizes in comment at top of `unicode_data.rs`
To make changes in table size obvious from git diffs
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/unicode-table-generator/src/main.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/tools/unicode-table-generator/src/main.rs b/src/tools/unicode-table-generator/src/main.rs index 6cdb82a87bd..c1017142097 100644 --- a/src/tools/unicode-table-generator/src/main.rs +++ b/src/tools/unicode-table-generator/src/main.rs @@ -239,6 +239,11 @@ fn main() { std::fs::write(&path, generate_tests(&write_location, ranges_by_property)).unwrap(); } + let mut table_file = String::new(); + table_file.push_str( + "///! This file is generated by `./x run src/tools/unicode-table-generator`; do not edit manually!\n", + ); + let mut total_bytes = 0; let mut modules = Vec::new(); for (property, ranges) in ranges_by_property { @@ -252,8 +257,8 @@ fn main() { } modules.push((property.to_lowercase().to_string(), emitter.file)); - println!( - "{:15}: {} bytes, {} codepoints in {} ranges ({} - {}) using {}", + table_file.push_str(&format!( + "// {:16}: {:5} bytes, {:6} codepoints in {:3} ranges (U+{:06X} - U+{:06X}) using {}\n", property, emitter.bytes_used, datapoints, @@ -261,15 +266,10 @@ fn main() { ranges.first().unwrap().start, ranges.last().unwrap().end, emitter.desc, - ); + )); total_bytes += emitter.bytes_used; } - - let mut table_file = String::new(); - - table_file.push_str( - "///! This file is generated by `./x run src/tools/unicode-table-generator`; do not edit manually!\n", - ); + table_file.push_str(&format!("// {:16}: {:5} bytes\n", "Total", total_bytes)); // Include the range search function table_file.push('\n'); @@ -296,8 +296,6 @@ fn main() { } std::fs::write(&write_location, format!("{}\n", table_file.trim_end())).unwrap(); - - println!("Total table sizes: {total_bytes} bytes"); } fn version() -> String { |
