Skip to content

Commit d0b3e37

Browse files
Or this.
1 parent cc96f37 commit d0b3e37

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

operation/src/clumper_options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl Optionsable for ClumperOptions {
2121
opt.add(clumper::REGISTRY.help_options("clumper"));
2222
opt.match_single(&["k", "key"], |p, a| {
2323
for a in a.split(',') {
24-
(p.0).0.push(clumper::key::Impl::init(&[a])?);
24+
(p.0).0.push(clumper::key::Impl::init2(Arc::from(a)));
2525
}
2626
return Result::Ok(());
2727
}, "keys to bucket by");

operation/src/sort.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ impl Optionsable for ImplBe2 {
3232
opt.add(SortOptions::help_options());
3333
opt.match_single(&["l", "lex", "lexical"], |p, a| {
3434
for a in a.split(',') {
35-
p.sorts.push(sorts::lexical::Impl::init(&[a])?);
35+
p.sorts.push(sorts::lexical::Impl::init2(Arc::from(a)));
3636
}
3737
return Result::Ok(());
3838
}, "keys to sort by lexically, prefix with minus to sort descending");
3939
opt.match_single(&["n", "num", "numeric"], |p, a| {
4040
for a in a.split(',') {
41-
p.sorts.push(sorts::numeric::Impl::init(&[a])?);
41+
p.sorts.push(sorts::numeric::Impl::init2(Arc::from(a)));
4242
}
4343
return Result::Ok(());
4444
}, "keys to sort by numerically, prefix with minus to sort descending");

registry/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ impl<R: 'static> Registry<R> {
4040
argct: I::Args::argct(),
4141
help_meta: I::help_meta(),
4242
help_msg: I::help_msg(),
43-
init: Box::new(I::init),
43+
init: Box::new(|args| {
44+
let a = I::Args::parse(args)?;
45+
let r = I::init2(a);
46+
return Result::Ok(r);
47+
}),
4448
});
4549
for name in &data.names {
4650
let prev = self.map.insert(name, data.clone());
@@ -195,8 +199,4 @@ pub trait Registrant<R> {
195199
fn help_msg() -> &'static str;
196200

197201
fn init2(a: <Self::Args as RegistryArgs>::Val) -> R;
198-
199-
fn init(args: &[&str]) -> ValidationResult<R> {
200-
return Result::Ok(Self::init2(Self::Args::parse(args)?));
201-
}
202202
}

0 commit comments

Comments
 (0)