From e186482ca00f8d884ddcbe20417f3654d03315a4 Mon Sep 17 00:00:00 2001 From: tottoto Date: Sat, 3 Aug 2024 19:37:52 +0900 Subject: [PATCH] Remove unnecessary custom clap value parser (#147) --- src/bin/cli.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/bin/cli.rs b/src/bin/cli.rs index 43b7b90..1f175d6 100644 --- a/src/bin/cli.rs +++ b/src/bin/cli.rs @@ -2,7 +2,6 @@ use mini_redis::{clients::Client, DEFAULT_PORT}; use bytes::Bytes; use clap::{Parser, Subcommand}; -use std::convert::Infallible; use std::num::ParseIntError; use std::str; use std::time::Duration; @@ -29,7 +28,6 @@ struct Cli { enum Command { Ping { /// Message to ping - #[arg(value_parser = bytes_from_str)] msg: Option, }, /// Get the value of key. @@ -43,7 +41,6 @@ enum Command { key: String, /// Value to set. - #[arg(value_parser = bytes_from_str)] value: Bytes, /// Expire the value after specified amount of time @@ -55,7 +52,6 @@ enum Command { /// Name of channel channel: String, - #[arg(value_parser = bytes_from_str)] /// Message to publish message: Bytes, }, @@ -153,7 +149,3 @@ fn duration_from_ms_str(src: &str) -> Result { let ms = src.parse::()?; Ok(Duration::from_millis(ms)) } - -fn bytes_from_str(src: &str) -> Result { - Ok(Bytes::from(src.to_string())) -}