Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e9fa99d

Browse files
committed
rustfmt: avoid duplicating the error handling for --emit
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]>
1 parent fa3cadf commit e9fa99d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/bin/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,8 @@ impl GetOptsOptions {
496496
if options.check {
497497
return Err(format_err!("Invalid to use `--emit` and `--check`"));
498498
}
499-
if let Ok(emit_mode) = emit_mode_from_emit_str(emit_str) {
500-
options.emit_mode = emit_mode;
501-
} else {
502-
return Err(format_err!("Invalid value for `--emit`"));
503-
}
499+
500+
options.emit_mode = emit_mode_from_emit_str(emit_str)?;
504501
}
505502

506503
if matches.opt_present("backup") {

0 commit comments

Comments
 (0)