Skip to content

Commit

Permalink
Deps: minimize Tokio features (#25)
Browse files Browse the repository at this point in the history
* Deps: use specific Tokio features

* Deps: run `cargo update`

* Refactor: move CLI-parsing outside Tokio runtime

* Fix: use `parse` over `try_parse`

Clap does special things behind the scenes before it exits.

* Refactor: use `tokio::main` macro for convenience
  • Loading branch information
BastiDood authored Apr 14, 2022
1 parent 36a56c0 commit b045d80
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 32 deletions.
40 changes: 14 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ hmac = "0.12.1"
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.79"
sha2 = "0.10.2"
tokio = { version = "1.17.0", features = ["full"] }
tokio = { version = "1.17.0", features = ["rt-multi-thread", "io-util", "macros", "net", "time"] }
tracing = "0.1.32"
tracing-subscriber = "0.3.10"
uuid = { version = "0.8.2", features = ["serde", "v4"] }

[dev-dependencies]
lazy_static = "1.4.0"
rstest = "0.12.0"
tokio = { version = "1.17.0", features = ["sync"] }
12 changes: 7 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ enum Command {
}

#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt::init();

let args = Args::parse();
match args.command {
async fn run(command: Command) -> Result<()> {
match command {
Command::Local {
local_host,
local_port,
Expand All @@ -69,3 +66,8 @@ async fn main() -> Result<()> {

Ok(())
}

fn main() -> Result<()> {
tracing_subscriber::fmt::init();
run(Args::parse().command)
}

0 comments on commit b045d80

Please sign in to comment.