Skip to content

Commit

Permalink
fix: use &str to get operation
Browse files Browse the repository at this point in the history
  • Loading branch information
mxthevs authored and fdaciuk committed Jun 15, 2022
1 parent 2319943 commit 1fafc34
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ fn usage() -> ! {
std::process::exit(0)
}

fn operation_of_string(arg: String) -> Operation {
match arg.as_str() {
fn operation_of_string(arg: &str) -> Operation {
match arg {
"h" | "help" => Operation::Help,
_ => {
eprintln!("ERROR: invalid argument \"{}\"", arg);
Expand All @@ -104,7 +104,7 @@ fn parse_cli(argument: String) -> Operation {
.filter(|char| char != &'-')
.collect::<String>();

operation_of_string(arg_name)
operation_of_string(&arg_name)
} else {
Operation::Version(argument)
}
Expand Down

0 comments on commit 1fafc34

Please sign in to comment.