Skip to content

Commit e186482

Browse files
authored
Remove unnecessary custom clap value parser (#147)
1 parent b63a489 commit e186482

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

Diff for: src/bin/cli.rs

-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use mini_redis::{clients::Client, DEFAULT_PORT};
22

33
use bytes::Bytes;
44
use clap::{Parser, Subcommand};
5-
use std::convert::Infallible;
65
use std::num::ParseIntError;
76
use std::str;
87
use std::time::Duration;
@@ -29,7 +28,6 @@ struct Cli {
2928
enum Command {
3029
Ping {
3130
/// Message to ping
32-
#[arg(value_parser = bytes_from_str)]
3331
msg: Option<Bytes>,
3432
},
3533
/// Get the value of key.
@@ -43,7 +41,6 @@ enum Command {
4341
key: String,
4442

4543
/// Value to set.
46-
#[arg(value_parser = bytes_from_str)]
4744
value: Bytes,
4845

4946
/// Expire the value after specified amount of time
@@ -55,7 +52,6 @@ enum Command {
5552
/// Name of channel
5653
channel: String,
5754

58-
#[arg(value_parser = bytes_from_str)]
5955
/// Message to publish
6056
message: Bytes,
6157
},
@@ -153,7 +149,3 @@ fn duration_from_ms_str(src: &str) -> Result<Duration, ParseIntError> {
153149
let ms = src.parse::<u64>()?;
154150
Ok(Duration::from_millis(ms))
155151
}
156-
157-
fn bytes_from_str(src: &str) -> Result<Bytes, Infallible> {
158-
Ok(Bytes::from(src.to_string()))
159-
}

0 commit comments

Comments
 (0)