Skip to content

Commit

Permalink
Simplify match block
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieClarken committed Dec 6, 2019
1 parent bb77917 commit 0a20521
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,10 @@ impl<'a> Toolchain<'a> {
(self.cfg.notify_handler)(Notification::InstalledToolchain(&self.name));
}

let status = match (updated, previous_version.is_some()) {
(true, false) => UpdateStatus::Installed,
(true, true) => UpdateStatus::Updated(previous_version.unwrap()),
(false, true) => UpdateStatus::Unchanged,
(false, false) => UpdateStatus::Unchanged,
let status = match (updated, previous_version) {
(true, None) => UpdateStatus::Installed,
(true, Some(v)) => UpdateStatus::Updated(v),
(false, _) => UpdateStatus::Unchanged,
};

Ok(status)
Expand Down

0 comments on commit 0a20521

Please sign in to comment.