@@ -616,13 +616,8 @@ impl ResourceDef {
616
616
profile_method ! ( find_match) ;
617
617
618
618
match & self . pat_type {
619
- PatternType :: Static ( segment) => {
620
- if segment == path {
621
- Some ( segment. len ( ) )
622
- } else {
623
- None
624
- }
625
- }
619
+ PatternType :: Static ( segment) if path == segment => Some ( segment. len ( ) ) ,
620
+ PatternType :: Static ( _) => None ,
626
621
627
622
PatternType :: Prefix ( prefix) if path == prefix => Some ( prefix. len ( ) ) ,
628
623
PatternType :: Prefix ( prefix) if is_strict_prefix ( prefix, path) => Some ( prefix. len ( ) ) ,
@@ -660,7 +655,7 @@ impl ResourceDef {
660
655
/// ```
661
656
pub fn capture_match_info < T : ResourcePath > ( & self , path : & mut Path < T > ) -> bool {
662
657
profile_method ! ( is_path_match) ;
663
- self . capture_match_info_fn ( path, & |_, _| true , & None :: < ( ) > )
658
+ self . capture_match_info_fn ( path, |_, _| true , ( ) )
664
659
}
665
660
666
661
/// Collects dynamic segment values into `resource` after matching paths and executing
@@ -683,7 +678,7 @@ impl ResourceDef {
683
678
/// resource.capture_match_info_fn(
684
679
/// path,
685
680
/// // when env var is not set, reject when path contains "admin"
686
- /// & |res, admin_allowed| !res.path().contains("admin"),
681
+ /// |res, admin_allowed| !res.path().contains("admin"),
687
682
/// &admin_allowed
688
683
/// )
689
684
/// }
@@ -704,13 +699,13 @@ impl ResourceDef {
704
699
pub fn capture_match_info_fn < R , T , F , U > (
705
700
& self ,
706
701
resource : & mut R ,
707
- check_fn : & F ,
708
- user_data : & Option < U > ,
702
+ check_fn : F ,
703
+ user_data : U ,
709
704
) -> bool
710
705
where
711
706
R : Resource < T > ,
712
707
T : ResourcePath ,
713
- F : Fn ( & R , & Option < U > ) -> bool ,
708
+ F : FnOnce ( & R , U ) -> bool ,
714
709
{
715
710
profile_method ! ( is_path_match_fn) ;
716
711
0 commit comments