1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-02 21:39:26 +00: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 {
#[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<G>(pub G);
impl<G: Guard> Guard for Not<G> {
#[inline]
fn check(&self, ctx: &GuardContext<'_>) -> bool {
!self.0.check(ctx)
}

View file

@ -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<Cow<'static, str>>) -> Self {
Self {