Skip to content

Commit 281ad29

Browse files
committed
Fix panic in option handling
1 parent 4df5646 commit 281ad29

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ fn command() -> clap::Command {
4949
fn get_opts() -> Opts {
5050
let opts = command().get_matches();
5151

52-
if let Some(val) = opts.get_one::<&str>("setup-device") {
53-
Opts::SetupDevice(val.to_string())
54-
} else if let Some(val) = opts.get_one::<&str>("reset-device") {
55-
Opts::ResetDevice(val.to_string())
52+
if let Some(val) = opts.get_one::<String>("setup-device") {
53+
Opts::SetupDevice(val.clone())
54+
} else if let Some(val) = opts.get_one::<String>("reset-device") {
55+
Opts::ResetDevice(val.clone())
5656
} else {
57-
let val = opts.get_one::<&str>("dir").expect("clap invariant");
58-
Opts::GenerateUnits(val.to_string())
57+
let val = opts.get_one::<String>("dir").expect("clap invariant");
58+
Opts::GenerateUnits(val.clone())
5959
}
6060
}
6161

0 commit comments

Comments
 (0)