Skip to content

Commit

Permalink
rustfmt: avoid duplicating the error handling for --emit
Browse files Browse the repository at this point in the history
There is no need to produce the error message again as it is already
produced by the helper method that does the emit mode validation.

Signed-off-by: Otavio Salvador <[email protected]>
  • Loading branch information
otavio committed Oct 23, 2018
1 parent fa3cadf commit e9fa99d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,8 @@ impl GetOptsOptions {
if options.check {
return Err(format_err!("Invalid to use `--emit` and `--check`"));
}
if let Ok(emit_mode) = emit_mode_from_emit_str(emit_str) {
options.emit_mode = emit_mode;
} else {
return Err(format_err!("Invalid value for `--emit`"));
}

options.emit_mode = emit_mode_from_emit_str(emit_str)?;
}

if matches.opt_present("backup") {
Expand Down

0 comments on commit e9fa99d

Please sign in to comment.