From 7ab1c427b54373fe69c4e9df526aeaf5d1d2eed6 Mon Sep 17 00:00:00 2001 From: Konrad Borowski Date: Sun, 9 Dec 2018 20:24:37 +0100 Subject: [PATCH] Replace uses of `FnBox`; `Box` now implements `FnOnce`. --- core/lib/build.rs | 4 ++-- core/lib/src/fairing/ad_hoc.rs | 23 ++++++++++++----------- core/lib/src/lib.rs | 1 - 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/lib/build.rs b/core/lib/build.rs index 1b983106..8db27778 100644 --- a/core/lib/build.rs +++ b/core/lib/build.rs @@ -8,8 +8,8 @@ use yansi::Color::{Red, Yellow, Blue}; use version_check::{supports_features, is_min_version, is_min_date}; // Specifies the minimum nightly version needed to compile Rocket. -const MIN_DATE: &'static str = "2019-02-25"; -const MIN_VERSION: &'static str = "1.34.0-nightly"; +const MIN_DATE: &'static str = "2019-04-05"; +const MIN_VERSION: &'static str = "1.35.0-nightly"; fn main() { let ok_channel = supports_features(); diff --git a/core/lib/src/fairing/ad_hoc.rs b/core/lib/src/fairing/ad_hoc.rs index cf41cf5c..b8e7ad73 100644 --- a/core/lib/src/fairing/ad_hoc.rs +++ b/core/lib/src/fairing/ad_hoc.rs @@ -1,5 +1,4 @@ use std::sync::Mutex; -use std::boxed::FnBox; use {Rocket, Request, Response, Data}; use fairing::{Fairing, Kind, Info}; @@ -43,14 +42,14 @@ pub struct AdHoc { enum AdHocKind { /// An ad-hoc **attach** fairing. Called when the fairing is attached. - Attach(Mutex Result + Send + 'static>>>), + Attach(Mutex Result + Send + 'static>>>), /// An ad-hoc **launch** fairing. Called just before Rocket launches. - Launch(Mutex>>), + Launch(Mutex>>), /// An ad-hoc **request** fairing. Called when a request is received. - Request(Box), + Request(Box), /// An ad-hoc **response** fairing. Called when a response is ready to be /// sent to a client. - Response(Box), + Response(Box), } impl AdHoc { @@ -146,9 +145,10 @@ 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"); - option.take() - .expect("internal error: `on_attach` single-call invariant broken") - .call_box((rocket,)) + let f = option + .take() + .expect("internal error: `on_attach` single-call invariant broken"); + f(rocket) } else { Ok(rocket) } @@ -157,9 +157,10 @@ 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"); - option.take() - .expect("internal error: `on_launch` single-call invariant broken") - .call_box((rocket, )) + let f = option + .take() + .expect("internal error: `on_launch` single-call invariant broken"); + f(rocket) } } diff --git a/core/lib/src/lib.rs b/core/lib/src/lib.rs index af5c10e9..dd85024c 100644 --- a/core/lib/src/lib.rs +++ b/core/lib/src/lib.rs @@ -1,7 +1,6 @@ #![feature(specialization)] #![feature(decl_macro)] #![feature(try_trait)] -#![feature(fnbox)] #![feature(never_type)] #![feature(proc_macro_hygiene)] #![feature(crate_visibility_modifier)]