Skip to content

Commit b44851c

Browse files
committed
A little cleaner
1 parent f89d6bc commit b44851c

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

step06_redis/code/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ edition = "2024"
66
clap = { version = "4.0", features = ["derive"] }
77
redis = { version = "0.29.2", features = ["tokio-comp"] }
88
tokio = { version = "1", features = ["full"] }
9-
anyhow = "1.0"
9+
anyhow = "1.0"

step06_redis/code/src/main.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ async fn main() -> ExitCode {
3636
let args = Args::parse();
3737

3838
match args.mode.as_str() {
39-
"check" => try_check(&args).await.map_or(1, |_| 0),
40-
"test" => try_test(&args).await.map_or(1, |_| 0),
41-
_ => {
42-
println!("This `--mode` value is not supported.");
43-
1
44-
}
45-
}.into()
39+
"check" => try_check(&args).await,
40+
"test" => try_test(&args).await,
41+
_ => Err(anyhow!("This `--mode` value is not supported."))
42+
}.map_or_else(|err| { println!("Error: {}", err); 1 }, |_| 0).into()
4643
}

0 commit comments

Comments
 (0)