Skip to content

Commit 869c47d

Browse files
committed
refactor: prettify the else .. if chain in determine_file_format_from_name
1 parent 4f108cb commit 869c47d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

runtime_tracing_cli/src/main.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ struct RuntimeTracingCli {
2626
fn determine_file_format_from_name(s: &str) -> Option<TraceEventsFileFormat> {
2727
if s.ends_with(".json") {
2828
Some(TraceEventsFileFormat::Json)
29+
} else if s.ends_with(".bin") {
30+
Some(TraceEventsFileFormat::Binary)
2931
} else {
30-
if s.ends_with(".bin") {
31-
Some(TraceEventsFileFormat::Binary)
32-
} else {
33-
None
34-
}
32+
None
3533
}
3634
}
3735

0 commit comments

Comments
 (0)