mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
perf: Drop use of Into::into for '?'
For binary size, this only dropped 0.2 KiB For performance, before: - parse_rustup_with_sc time: [7.9866 µs 8.0138 µs 8.0470 µs] After: - parse_rustup_with_sc time: [7.5387 µs 7.5722 µs 7.6157 µs] For build-time, before ```console $ hyperfine --warmup=1 --min-runs=5 "--prepare=cargo clean" "cargo build -F cargo --example cargo-example" Benchmark 1: cargo build -F cargo --example cargo-example Time (mean ± σ): 16.988 s ± 1.190 s [User: 68.178 s, System: 6.637 s] Range (min … max): 15.550 s … 18.277 s 5 runs ``` After: ```console $ hyperfine --warmup=1 --min-runs=5 "--prepare=cargo clean" "cargo build -F cargo --example cargo-example" Benchmark 1: cargo build -F cargo --example cargo-example Time (mean ± σ): 15.674 s ± 0.222 s [User: 62.287 s, System: 4.608 s] Range (min … max): 15.426 s … 15.993 s 5 runs ```
This commit is contained in:
parent
c4b3a4f491
commit
4a1552cc0e
1 changed files with 12 additions and 2 deletions
|
@ -664,12 +664,22 @@ macro_rules! debug {
|
|||
|
||||
macro_rules! ok {
|
||||
($expr:expr) => {
|
||||
$expr?
|
||||
match $expr {
|
||||
Ok(val) => val,
|
||||
Err(err) => {
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! some {
|
||||
($expr:expr) => {
|
||||
$expr?
|
||||
match $expr {
|
||||
Some(val) => val,
|
||||
None => {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue