Skip to content

Commit 7c8c3b5

Browse files
committed
fix(cmd): remove todo!() panic from HTTP command
Made payload_json a required argument (non-Option) instead of having a todo!() that would panic at runtime when no payload was provided. This provides proper compile-time guarantees.
1 parent f3c01c2 commit 7c8c3b5

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

dwd/src/cmd.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ pub struct HttpCmd {
7777
#[clap(short, long, default_value_t = std::thread::available_parallelism().unwrap_or(NonZero::<usize>::MIN))]
7878
pub concurrency: NonZero<usize>,
7979
/// Path to the JSON payload file.
80-
#[clap(long, value_name = "PATH", required = true)]
81-
pub payload_json: Option<PathBuf>,
80+
#[clap(long, value_name = "PATH")]
81+
pub payload_json: PathBuf,
8282
/// Set linger TCP option with specified value.
8383
#[clap(long)]
8484
pub tcp_linger: Option<u64>,
@@ -107,13 +107,7 @@ where
107107
tcp_no_delay,
108108
} = cmd;
109109

110-
let requests = {
111-
if let Some(path) = payload_json {
112-
JsonLineRecord::from_fs(path)?
113-
} else {
114-
todo!();
115-
}
116-
};
110+
let requests = JsonLineRecord::from_fs(payload_json)?;
117111

118112
let m = Self {
119113
addr,

0 commit comments

Comments
 (0)