Use split_once instead of split().nth(1)

This commit is contained in:
Felix Schütt
2022-10-13 18:49:39 +02:00
parent 600dc2dfc7
commit a1548ec7ff
2 changed files with 10 additions and 19 deletions

View File

@@ -478,18 +478,14 @@ fn print_packages() -> Result<(), anyhow::Error> {
.collect::<Vec<_>>();
let empty_table = rows.is_empty();
let mut table = Table::init(rows);
table.set_titles(row!["Registry", "Package", "Version", "Commands"]);
table.set_format(*format::consts::FORMAT_NO_LINESEP_WITH_TITLE);
table.set_format(*format::consts::FORMAT_NO_COLSEP);
if empty_table {
println!("--------------------------------------");
println!("Registry Package Version Commands ");
println!("======================================");
println!();
} else {
let mut table = Table::init(rows);
table.set_titles(row!["Registry", "Package", "Version", "Commands"]);
table.set_format(*format::consts::FORMAT_NO_LINESEP_WITH_TITLE);
table.set_format(*format::consts::FORMAT_NO_COLSEP);
let _ = table.printstd();
}
table.add_empty_row();
}
let _ = table.printstd();
Ok(())
}