Skip to content

Commit 7372359

Browse files
authored
Merge pull request #1154 from kbknapp/v3-prep
v3 Prep
2 parents 969c3ad + 4c54c2a commit 7372359

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+6804
-6874
lines changed

Diff for: Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ appveyor = { repository = "kbknapp/clap-rs" }
2323
bitflags = "1.0"
2424
unicode-width = "0.1.4"
2525
textwrap = "0.9.0"
26+
ordermap = "0.3.5"
2627
strsim = { version = "0.7.0", optional = true }
2728
ansi_term = { version = "0.10.0", optional = true }
2829
yaml-rust = { version = "0.3.5", optional = true }

Diff for: TODO.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
- [ ] update-todo.sh
2+
- [ ] src/lib.rs
3+
-[ ] 578:@TODO @release @docs
4+
-[ ] 580:@TODO @release @docs
5+
-[ ] 583:@TODO @release @docs
6+
-[ ] 592:@TODO @release @docs
7+
-[ ] 598:@TODO @release @docs
8+
-[ ] 608:@TODO @release @docs
9+
-[ ] 610:@TODO @release @docs
10+
-[ ] 614:@TODO @release @docs
11+
-[ ] 616:@TODO @release @docs
12+
-[ ] 619:@TODO @release @docs
13+
-[ ] 623:@TODO @release @docs
14+
- [ ] src/app/parser.rs
15+
-[ ] 678:@TODO @perf: cloning all these Apps ins't great, but since it's just displaying the help
16+
- [ ] src/app/mod.rs
17+
-[ ] 1760:@TODO @v3-alpha @perf: should only propagate globals to subcmd we find, or for help
18+
- [ ] src/args/arg.rs
19+
-[ ] 3545:@TODO @p2 @docs @release: write docs

Diff for: benches/01_default.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@ use clap::App;
88
use test::Bencher;
99

1010
#[bench]
11-
fn build_app(b: &mut Bencher) {
12-
b.iter(|| App::new("claptests"));
13-
}
11+
fn build_app(b: &mut Bencher) { b.iter(|| App::new("claptests")); }
1412

1513
#[bench]
16-
fn parse_clean(b: &mut Bencher) {
17-
b.iter(|| App::new("claptests").get_matches_from(vec![""]));
18-
}
14+
fn parse_clean(b: &mut Bencher) { b.iter(|| App::new("claptests").get_matches_from(vec![""])); }

Diff for: benches/02_simple.rs

+9-28
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,18 @@ macro_rules! create_app {
2020
}
2121

2222
#[bench]
23-
fn build_app(b: &mut Bencher) {
24-
25-
b.iter(|| create_app!());
26-
}
23+
fn build_app(b: &mut Bencher) { b.iter(|| create_app!()); }
2724

2825
#[bench]
2926
fn add_flag(b: &mut Bencher) {
30-
fn build_app() -> App<'static, 'static> {
31-
App::new("claptests")
32-
}
27+
fn build_app() -> App<'static, 'static> { App::new("claptests") }
3328

3429
b.iter(|| build_app().arg(Arg::from_usage("-s, --some 'something'")));
3530
}
3631

3732
#[bench]
3833
fn add_flag_ref(b: &mut Bencher) {
39-
fn build_app() -> App<'static, 'static> {
40-
App::new("claptests")
41-
}
34+
fn build_app() -> App<'static, 'static> { App::new("claptests") }
4235

4336
b.iter(|| {
4437
let arg = Arg::from_usage("-s, --some 'something'");
@@ -48,18 +41,14 @@ fn add_flag_ref(b: &mut Bencher) {
4841

4942
#[bench]
5043
fn add_opt(b: &mut Bencher) {
51-
fn build_app() -> App<'static, 'static> {
52-
App::new("claptests")
53-
}
44+
fn build_app() -> App<'static, 'static> { App::new("claptests") }
5445

5546
b.iter(|| build_app().arg(Arg::from_usage("-s, --some <FILE> 'something'")));
5647
}
5748

5849
#[bench]
5950
fn add_opt_ref(b: &mut Bencher) {
60-
fn build_app() -> App<'static, 'static> {
61-
App::new("claptests")
62-
}
51+
fn build_app() -> App<'static, 'static> { App::new("claptests") }
6352

6453
b.iter(|| {
6554
let arg = Arg::from_usage("-s, --some <FILE> 'something'");
@@ -69,18 +58,14 @@ fn add_opt_ref(b: &mut Bencher) {
6958

7059
#[bench]
7160
fn add_pos(b: &mut Bencher) {
72-
fn build_app() -> App<'static, 'static> {
73-
App::new("claptests")
74-
}
61+
fn build_app() -> App<'static, 'static> { App::new("claptests") }
7562

7663
b.iter(|| build_app().arg(Arg::with_name("some")));
7764
}
7865

7966
#[bench]
8067
fn add_pos_ref(b: &mut Bencher) {
81-
fn build_app() -> App<'static, 'static> {
82-
App::new("claptests")
83-
}
68+
fn build_app() -> App<'static, 'static> { App::new("claptests") }
8469

8570
b.iter(|| {
8671
let arg = Arg::with_name("some");
@@ -89,14 +74,10 @@ fn add_pos_ref(b: &mut Bencher) {
8974
}
9075

9176
#[bench]
92-
fn parse_clean(b: &mut Bencher) {
93-
b.iter(|| create_app!().get_matches_from(vec![""]));
94-
}
77+
fn parse_clean(b: &mut Bencher) { b.iter(|| create_app!().get_matches_from(vec![""])); }
9578

9679
#[bench]
97-
fn parse_flag(b: &mut Bencher) {
98-
b.iter(|| create_app!().get_matches_from(vec!["myprog", "-f"]));
99-
}
80+
fn parse_flag(b: &mut Bencher) { b.iter(|| create_app!().get_matches_from(vec!["myprog", "-f"])); }
10081

10182
#[bench]
10283
fn parse_option(b: &mut Bencher) {

0 commit comments

Comments
 (0)