diff --git a/actix-web/src/guard/mod.rs b/actix-web/src/guard/mod.rs index 5fcaec0de..7cd846b66 100644 --- a/actix-web/src/guard/mod.rs +++ b/actix-web/src/guard/mod.rs @@ -196,6 +196,7 @@ impl AnyGuard { } impl Guard for AnyGuard { + #[inline] fn check(&self, ctx: &GuardContext<'_>) -> bool { for guard in &self.guards { if guard.check(ctx) { @@ -247,12 +248,14 @@ impl AllGuard { } impl Guard for AllGuard { + #[inline] fn check(&self, ctx: &GuardContext<'_>) -> bool { for guard in &self.guards { if !guard.check(ctx) { return false; } } + true } } @@ -271,6 +274,7 @@ impl Guard for AllGuard { pub struct Not(pub G); impl Guard for Not { + #[inline] fn check(&self, ctx: &GuardContext<'_>) -> bool { !self.0.check(ctx) } diff --git a/actix-web/src/redirect.rs b/actix-web/src/redirect.rs index ca9e23aa4..5611cc368 100644 --- a/actix-web/src/redirect.rs +++ b/actix-web/src/redirect.rs @@ -31,7 +31,7 @@ use crate::{ /// /// As responder: /// ``` -/// use actix_web::web::Redirect; +/// use actix_web::{web::Redirect, Responder}; /// /// async fn handler() -> impl Responder { /// // sends a permanent (308) redirect to duck.com @@ -84,13 +84,13 @@ impl Redirect { /// /// # Examples /// ``` - /// use actix_web::web::Redirect; + /// use actix_web::{web::Redirect, Responder}; /// /// async fn admin_page() -> impl Responder { /// // sends a temporary 307 redirect to the login path /// Redirect::to("/login") /// } - /// # actix_web::web::to(handler); + /// # actix_web::web::to(admin_page); /// ``` pub fn to(to: impl Into>) -> Self { Self {