From 9e37e76c3bb147de4b15ad6521ebd7a09605bd4a Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 16 Aug 2023 14:30:18 -0400 Subject: [PATCH] lib: Dispatch to monomorphic function I was looking at `cargo bloat` and this showed up near the top twice. It's a large function and only the option parsing needs to be generic. --- lib/src/cli.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/cli.rs b/lib/src/cli.rs index f786df07..ffdf5804 100644 --- a/lib/src/cli.rs +++ b/lib/src/cli.rs @@ -818,7 +818,10 @@ where I: IntoIterator, I::Item: Into + Clone, { - let opt = Opt::parse_from(args); + run_from_opt(Opt::parse_from(args)).await +} + +async fn run_from_opt(opt: Opt) -> Result<()> { match opt { Opt::Tar(TarOpts::Import(ref opt)) => tar_import(opt).await, Opt::Tar(TarOpts::Export(ref opt)) => tar_export(opt),