From 686a0ed964f236f9bda6cdcff5d600f9c34ac697 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Sat, 26 Jun 2021 16:42:07 -0700 Subject: [PATCH] Fix wording in 'config' docs. --- core/lib/src/config/mod.rs | 5 ++--- core/lib/tests/sentinel.rs | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/core/lib/src/config/mod.rs b/core/lib/src/config/mod.rs index 49340cbe..a5072365 100644 --- a/core/lib/src/config/mod.rs +++ b/core/lib/src/config/mod.rs @@ -6,9 +6,8 @@ //! //! ## Extracting Configuration Parameters //! -//! Rocket exposes the active [`Figment`] via [`Rocket::figment()`] and -//! [`Rocket::figment()`]. Any value that implements [`Deserialize`] can be -//! extracted from the figment: +//! Rocket exposes the active [`Figment`] via [`Rocket::figment()`]. Any value +//! that implements [`Deserialize`] can be extracted from the figment: //! //! ```rust //! use rocket::fairing::AdHoc; diff --git a/core/lib/tests/sentinel.rs b/core/lib/tests/sentinel.rs index 69577a8c..2f77b899 100644 --- a/core/lib/tests/sentinel.rs +++ b/core/lib/tests/sentinel.rs @@ -3,8 +3,8 @@ use rocket::{*, error::ErrorKind::SentinelAborts}; #[get("/two")] fn two_states(_one: &State, _two: &State) {} -#[get("/one")] -fn one_state(_three: &State) {} +#[post("/one", data = "")] +fn one_state<'r>(_three: &'r State, s: &'r str) -> &'r str { s } #[async_test] async fn state_sentinel_works() { @@ -242,27 +242,27 @@ async fn known_macro_sentinel_works() { use rocket::tokio::io::AsyncRead; #[derive(Responder)] - struct TextSentinel(&'static str); + struct TextSentinel<'r>(&'r str); - impl Sentinel for TextSentinel { + impl Sentinel for TextSentinel<'_> { fn abort(_: &Rocket) -> bool { true } } - impl AsRef for TextSentinel { + impl AsRef for TextSentinel<'_> { fn as_ref(&self) -> &str { self.0 } } - impl AsRef<[u8]> for TextSentinel { + impl AsRef<[u8]> for TextSentinel<'_> { fn as_ref(&self) -> &[u8] { self.0.as_bytes() } } - impl AsyncRead for TextSentinel { + impl AsyncRead for TextSentinel<'_> { fn poll_read( self: std::pin::Pin<&mut Self>, _: &mut futures::task::Context<'_>, @@ -273,18 +273,18 @@ async fn known_macro_sentinel_works() { } #[get("/text")] - fn text() -> TextStream![TextSentinel] { + fn text<'r>() -> TextStream![TextSentinel<'r>] { TextStream!(yield TextSentinel("hi");) } - #[get("/bytes")] - fn byte() -> ByteStream![TextSentinel] { - ByteStream!(yield TextSentinel("hi");) + #[get("/")] + fn byte(a: &str) -> ByteStream![TextSentinel<'_>] { + ByteStream!(yield TextSentinel(a);) } - #[get("/reader")] - fn reader() -> ReaderStream![TextSentinel] { - ReaderStream!(yield TextSentinel("hi");) + #[get("/<_a>/")] + fn reader<'a, 'b>(_a: &'a str, b: &'b str) -> ReaderStream![TextSentinel<'b>] { + ReaderStream!(yield TextSentinel(b);) } macro_rules! UnknownStream { @@ -292,7 +292,7 @@ async fn known_macro_sentinel_works() { } #[get("/ignore")] - fn ignore() -> UnknownStream![TextSentinel] { + fn ignore() -> UnknownStream![TextSentinel<'static>] { ReaderStream!(yield TextSentinel("hi");) }