1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-01-31 11:02:08 +01:00

fix doc tests

This commit is contained in:
Rob Ede 2022-11-25 23:28:31 +00:00
parent 3c69d078b2
commit 6d48593a60
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
2 changed files with 7 additions and 3 deletions

View File

@ -196,6 +196,7 @@ impl AnyGuard {
} }
impl Guard for AnyGuard { impl Guard for AnyGuard {
#[inline]
fn check(&self, ctx: &GuardContext<'_>) -> bool { fn check(&self, ctx: &GuardContext<'_>) -> bool {
for guard in &self.guards { for guard in &self.guards {
if guard.check(ctx) { if guard.check(ctx) {
@ -247,12 +248,14 @@ impl AllGuard {
} }
impl Guard for AllGuard { impl Guard for AllGuard {
#[inline]
fn check(&self, ctx: &GuardContext<'_>) -> bool { fn check(&self, ctx: &GuardContext<'_>) -> bool {
for guard in &self.guards { for guard in &self.guards {
if !guard.check(ctx) { if !guard.check(ctx) {
return false; return false;
} }
} }
true true
} }
} }
@ -271,6 +274,7 @@ impl Guard for AllGuard {
pub struct Not<G>(pub G); pub struct Not<G>(pub G);
impl<G: Guard> Guard for Not<G> { impl<G: Guard> Guard for Not<G> {
#[inline]
fn check(&self, ctx: &GuardContext<'_>) -> bool { fn check(&self, ctx: &GuardContext<'_>) -> bool {
!self.0.check(ctx) !self.0.check(ctx)
} }

View File

@ -31,7 +31,7 @@ use crate::{
/// ///
/// As responder: /// As responder:
/// ``` /// ```
/// use actix_web::web::Redirect; /// use actix_web::{web::Redirect, Responder};
/// ///
/// async fn handler() -> impl Responder { /// async fn handler() -> impl Responder {
/// // sends a permanent (308) redirect to duck.com /// // sends a permanent (308) redirect to duck.com
@ -84,13 +84,13 @@ impl Redirect {
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// use actix_web::web::Redirect; /// use actix_web::{web::Redirect, Responder};
/// ///
/// async fn admin_page() -> impl Responder { /// async fn admin_page() -> impl Responder {
/// // sends a temporary 307 redirect to the login path /// // sends a temporary 307 redirect to the login path
/// Redirect::to("/login") /// Redirect::to("/login")
/// } /// }
/// # actix_web::web::to(handler); /// # actix_web::web::to(admin_page);
/// ``` /// ```
pub fn to(to: impl Into<Cow<'static, str>>) -> Self { pub fn to(to: impl Into<Cow<'static, str>>) -> Self {
Self { Self {