Skip to content

Commit 0a65a4b

Browse files
cgzonesetke
authored andcommitted
Simplify format initialization
Avoid using a mutable variable.
1 parent d90389e commit 0a65a4b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/main.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,15 @@ fn main() {
328328
let procname = args.value_of("process");
329329
let procall = args.is_present("process-all");
330330

331-
let mut format = output::Format::Text;
332-
if args.is_present("json") {
333-
format = output::Format::Json;
331+
let format = if args.is_present("json") {
334332
if args.is_present("pretty") {
335-
format = output::Format::JsonPretty;
333+
output::Format::JsonPretty
334+
} else {
335+
output::Format::Json
336336
}
337-
}
337+
} else {
338+
output::Format::Text
339+
};
338340

339341
let settings = output::Settings::set(
340342
#[cfg(feature = "color")]

0 commit comments

Comments
 (0)