Skip to content

Commit

Permalink
Merge pull request #91 from epage/black
Browse files Browse the repository at this point in the history
fix: Don't print when benchmarking
  • Loading branch information
epage authored Feb 7, 2024
2 parents 985e4e2 + 101ff88 commit b1d0c92
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 81 deletions.
18 changes: 11 additions & 7 deletions examples/argh-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ fn parse_width(s: &str) -> Result<u32, String> {

fn main() {
let args: AppArgs = argh::from_env();
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}
18 changes: 11 additions & 7 deletions examples/bpaf-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ fn main() {

let args = parser.run();

println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}
18 changes: 11 additions & 7 deletions examples/bpaf_derive-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ fn valid_width(width: &u32) -> bool {
fn main() {
let args = app_args().run();

println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}
18 changes: 11 additions & 7 deletions examples/clap-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ fn main() {
.collect(),
};

println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}
18 changes: 11 additions & 7 deletions examples/clap-minimal-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ fn main() {
.collect(),
};

println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}
18 changes: 11 additions & 7 deletions examples/clap_derive-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ fn parse_width(s: &str) -> Result<u32, String> {

fn main() {
let args = AppArgs::parse();
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}
18 changes: 11 additions & 7 deletions examples/clap_lex-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ fn main() {
std::process::exit(1);
}
};
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}

fn parse_args() -> Result<AppArgs, BoxedError> {
Expand Down
18 changes: 11 additions & 7 deletions examples/gumdrop-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ fn parse_width(s: &str) -> Result<u32, String> {

fn main() {
let args = AppArgs::parse_args_default_or_exit();
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}
18 changes: 11 additions & 7 deletions examples/lexopt-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ fn main() {
std::process::exit(1);
}
};
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}

fn parse_args() -> Result<AppArgs, lexopt::Error> {
Expand Down
12 changes: 8 additions & 4 deletions examples/null-app/app.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
fn main() {
let args: Vec<_> = std::env::args_os().collect();
if 10 < args.len() {
println!("{:#?}", args.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
if 10 < args.len() {
println!("{:#?}", args.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}
18 changes: 11 additions & 7 deletions examples/pico-args-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ fn main() {
}
};

println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}

fn parse_args() -> Result<AppArgs, pico_args::Error> {
Expand Down
18 changes: 11 additions & 7 deletions examples/xflags-app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,16 @@ fn main() {
err.exit();
}
}
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
#[cfg(debug_assertions)]
{
println!("{:#?}", args.number);
println!("{:#?}", args.opt_number);
println!("{:#?}", args.width);
if 10 < args.input.len() {
println!("{:#?}", args.input.len());
} else {
println!("{:#?}", args);
}
}
std::hint::black_box(args);
}

0 comments on commit b1d0c92

Please sign in to comment.