1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 02:57:44 +00:00

Format everything using rustfmt

This commit is contained in:
Alex Lyon 2018-03-12 01:20:58 -07:00
parent 00a8b0b0f1
commit 880a4973c1
162 changed files with 7895 additions and 5056 deletions

View file

@ -16,8 +16,9 @@ pub fn main() {
if val == "1" && key.starts_with(feature_prefix) {
let krate = key[feature_prefix.len()..].to_lowercase();
match krate.as_ref() {
"default" | "unix" | "redox" | "redox_generic" | "fuchsia" | "generic" | "nightly" | "test_unimplemented" => continue,
_ => {},
"default" | "unix" | "redox" | "redox_generic" | "fuchsia" | "generic"
| "nightly" | "test_unimplemented" => continue,
_ => {}
}
crates.push(krate.to_string());
}
@ -27,18 +28,23 @@ pub fn main() {
let mut cf = File::create(Path::new(&out_dir).join("uutils_crates.rs")).unwrap();
let mut mf = File::create(Path::new(&out_dir).join("uutils_map.rs")).unwrap();
mf.write_all("
mf.write_all(
"
type UtilityMap = HashMap<&'static str, fn(Vec<String>) -> i32>;
fn util_map() -> UtilityMap {
let mut map: UtilityMap = HashMap::new();\n".as_bytes()).unwrap();
let mut map: UtilityMap = HashMap::new();\n"
.as_bytes(),
).unwrap();
for krate in crates {
cf.write_all(format!("extern crate uu_{krate};\n", krate=krate).as_bytes()).unwrap();
cf.write_all(format!("extern crate uu_{krate};\n", krate = krate).as_bytes())
.unwrap();
match krate.as_ref() {
"hashsum" => {
mf.write_all("map.insert(\"hashsum\", uu_hashsum::uumain);
mf.write_all(
"map.insert(\"hashsum\", uu_hashsum::uumain);
map.insert(\"md5sum\", uu_hashsum::uumain);
map.insert(\"sha1sum\", uu_hashsum::uumain);
map.insert(\"sha224sum\", uu_hashsum::uumain);
@ -51,10 +57,16 @@ pub fn main() {
map.insert(\"sha3-384sum\", uu_hashsum::uumain);
map.insert(\"sha3-512sum\", uu_hashsum::uumain);
map.insert(\"shake128sum\", uu_hashsum::uumain);
map.insert(\"shake256sum\", uu_hashsum::uumain);\n".as_bytes()).unwrap();
},
_ =>
mf.write_all(format!("map.insert(\"{krate}\", uu_{krate}::uumain);\n", krate=krate).as_bytes()).unwrap(),
map.insert(\"shake256sum\", uu_hashsum::uumain);\n"
.as_bytes(),
).unwrap();
}
_ => mf.write_all(
format!(
"map.insert(\"{krate}\", uu_{krate}::uumain);\n",
krate = krate
).as_bytes(),
).unwrap(),
}
}