[PR Feedback] Use `if let` to reduce nesting
@@ -243,8 +243,7 @@ impl Supervisor {
// group around AS a service group
let service_group = self.preamble.clone();
- match self.pid {
- Some(pid) => {
+ if let Some(pid) = self.pid {
let pidfile = self.pid_file.clone();
future::Either::A(terminator::terminate_service(pid, service_group).and_then(
@@ -253,14 +252,12 @@ impl Supervisor {
Ok(())
},
))
- }
- None => {
+ } else {
// Not quite sure how we'd get down here without a PID...
warn!("Attempted to stop {}, but we have no PID!", service_group);
future::Either::B(future::ok(()))
}
}
- }
pub fn restart<T>(
&mut self,
