From fdd76ecf7e23eeeaa1cd7a1b190e67f43a0d4ded Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Wed, 8 May 2019 21:22:09 -0700 Subject: [PATCH] Clean up 'AdHoc' fairing implementation. --- core/lib/src/fairing/ad_hoc.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/core/lib/src/fairing/ad_hoc.rs b/core/lib/src/fairing/ad_hoc.rs index b8e7ad73..e03b900e 100644 --- a/core/lib/src/fairing/ad_hoc.rs +++ b/core/lib/src/fairing/ad_hoc.rs @@ -144,10 +144,8 @@ impl Fairing for AdHoc { fn on_attach(&self, rocket: Rocket) -> Result { if let AdHocKind::Attach(ref mutex) = self.kind { - let mut option = mutex.lock().expect("AdHoc::Attach lock"); - let f = option - .take() - .expect("internal error: `on_attach` single-call invariant broken"); + let mut opt = mutex.lock().expect("AdHoc::Attach lock"); + let f = opt.take().expect("internal error: `on_attach` one-call invariant broken"); f(rocket) } else { Ok(rocket) @@ -156,10 +154,8 @@ impl Fairing for AdHoc { fn on_launch(&self, rocket: &Rocket) { if let AdHocKind::Launch(ref mutex) = self.kind { - let mut option = mutex.lock().expect("AdHoc::Launch lock"); - let f = option - .take() - .expect("internal error: `on_launch` single-call invariant broken"); + let mut opt = mutex.lock().expect("AdHoc::Launch lock"); + let f = opt.take().expect("internal error: `on_launch` one-call invariant broken"); f(rocket) } }