style: please dont forget to run cargo fmt...

This commit is contained in:
Teesh 2025-03-22 14:55:46 +02:00
parent 21743a5c07
commit 85e1dac2cf
4 changed files with 20 additions and 28 deletions

View file

@ -1,8 +1,8 @@
use boxutils::commands::Command;
use std::env;
use std::collections::HashMap;
use std::io::{self, Read, Write, BufReader};
use std::env;
use std::fs::File;
use std::io::{self, BufReader, Read, Write};
use std::time::Instant;
pub struct Dd;
@ -36,7 +36,7 @@ impl Command for Dd {
"GB" => blocksize = k.parse::<u64>().unwrap() * 1000 * 1000 * 1000,
_ => {
eprintln!("Invalid blocksize specified.");
return
return;
}
}
}
@ -66,15 +66,10 @@ impl Command for Dd {
println!(
"{}+{} records in", // TODO: actually calculate records in
out_blocks,
out_remainder
out_blocks, out_remainder
);
println!(
"{}+{} records out",
out_blocks,
out_remainder
);
println!("{}+{} records out", out_blocks, out_remainder);
println!(
"{} bytes ({}B) copied, {:.6} seconds, {:.2}KB/s",
@ -82,7 +77,6 @@ impl Command for Dd {
vecbuf.len(),
duration,
kb_per_sec
)
}
}

View file

@ -1,7 +1,7 @@
use boxutils::commands::Command;
use boxutils::args::ArgParser;
use std::env;
use boxutils::commands::Command;
use num_cpus::{get, get_physical};
use std::env;
pub struct Nproc;
@ -25,7 +25,7 @@ Prints the number of available CPUs to stdout.
--ignore=N, --ignore N Ignore N CPUs
"
);
return
return;
}
if args.get_flag("--all") {

View file

@ -1,8 +1,8 @@
use boxutils::commands::Command;
use std::env;
use std::process::Command as stdCommand;
use std::io::{self, Write, ErrorKind};
use std::io::{self, ErrorKind, Write};
use std::path::Path;
use std::process::Command as stdCommand;
pub struct Ash;
@ -26,16 +26,14 @@ impl Command for Ash {
let new_path = arguments.next();
let new_path = Path::new(new_path.unwrap());
let _ = env::set_current_dir(&new_path).is_ok();
},
}
command => {
let out = stdCommand::new(command)
.args(arguments)
.spawn();
let out = stdCommand::new(command).args(arguments).spawn();
match out {
Ok(mut out) => {
let _ = out.wait();
},
}
Err(err) => match err.kind() {
ErrorKind::NotFound => {
eprintln!("ash: {}: not found", command);
@ -46,10 +44,10 @@ impl Command for Ash {
_ => {
eprintln!("ash: uncaught error: {}", err);
}
}
}
},
}
}
}
}
}
}