fix doc test

This commit is contained in:
Rob Ede 2022-01-31 22:06:02 +00:00
parent 9eb77c0f89
commit a0e1c2cd7a
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
1 changed files with 3 additions and 4 deletions

View File

@ -651,11 +651,11 @@ impl ResourceDef {
/// ``` /// ```
/// use actix_router::{Path, ResourceDef}; /// use actix_router::{Path, ResourceDef};
/// ///
/// fn try_match(resource: &ResourceDef, resource: &mut Path<&str>) -> bool { /// fn try_match(resource: &ResourceDef, path: &mut Path<&str>) -> bool {
/// let admin_allowed = std::env::var("ADMIN_ALLOWED").is_ok(); /// let admin_allowed = std::env::var("ADMIN_ALLOWED").is_ok();
/// ///
/// resource.capture_match_info_fn( /// resource.capture_match_info_fn(
/// resource, /// path,
/// // when env var is not set, reject when path contains "admin" /// // when env var is not set, reject when path contains "admin"
/// |res| !(!admin_allowed && res.path().contains("admin")), /// |res| !(!admin_allowed && res.path().contains("admin")),
/// ) /// )
@ -1147,9 +1147,8 @@ pub(crate) fn insert_slash(path: &str) -> Cow<'_, str> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::Path;
use super::*; use super::*;
use crate::Path;
#[test] #[test]
fn equivalence() { fn equivalence() {