pad left instead of right, so units/thousands are aligned.

This commit is contained in:
KtorZ 2022-12-08 18:02:06 +01:00 committed by rvcas
parent 2ba712eef6
commit 4cae4a4467
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
1 changed files with 4 additions and 4 deletions

View File

@ -538,8 +538,8 @@ impl Project {
} else {
"FAIL".bold().red().to_string()
},
padding_right(mem.to_string(), max_mem, " "),
padding_right(cpu.to_string(), max_cpu, " "),
pad_left(mem.to_string(), max_mem, " "),
pad_left(cpu.to_string(), max_cpu, " "),
test.module.blue(),
test.name.bright_blue()
)
@ -707,13 +707,13 @@ fn is_aiken_path(path: &Path, dir: impl AsRef<Path>) -> bool {
)
}
fn padding_right(text: String, n: i32, delimiter: &str) -> String {
fn pad_left(text: String, n: i32, delimiter: &str) -> String {
let mut text = text.clone();
let diff = n - text.len() as i32;
if diff.is_positive() {
for _ in 0..diff {
text.push_str(delimiter);
text.insert_str(0, delimiter);
}
}