@@ -525,19 +525,19 @@ impl TokenStore {
525
525
if !is_root {
526
526
return Err ( RvError :: ErrRequestInvalid ) ;
527
527
}
528
- te. id = data. id . clone ( ) ;
528
+ te. id . clone_from ( & data. id ) ;
529
529
}
530
530
531
531
if data. policies . is_empty ( ) {
532
- data. policies = parent. policies . clone ( ) ;
532
+ data. policies . clone_from ( & parent. policies ) ;
533
533
sanitize_policies ( & mut data. policies , false ) ;
534
534
}
535
535
536
536
if !is_root && !is_str_subset ( & data. policies , & parent. policies ) {
537
537
return Err ( RvError :: ErrRequestInvalid ) ;
538
538
}
539
539
540
- te. policies = data. policies . clone ( ) ;
540
+ te. policies . clone_from ( & data. policies ) ;
541
541
542
542
for policy in te. policies . iter ( ) {
543
543
if NON_ASSIGNABLE_POLICIES . contains ( & policy. as_str ( ) ) {
@@ -657,7 +657,7 @@ impl TokenStore {
657
657
log:: debug!( "lookup token" ) ;
658
658
let mut id = req. get_data_as_str ( "token" ) ?;
659
659
if id. is_empty ( ) {
660
- id = req. client_token . clone ( ) ;
660
+ id. clone_from ( & req. client_token ) ;
661
661
}
662
662
663
663
if id. is_empty ( ) {
@@ -771,7 +771,7 @@ impl Handler for TokenStore {
771
771
return Err ( RvError :: ErrPermissionDenied ) ;
772
772
}
773
773
774
- req. name = auth. as_ref ( ) . unwrap ( ) . display_name . clone ( ) ;
774
+ req. name . clone_from ( & auth. as_ref ( ) . unwrap ( ) . display_name ) ;
775
775
req. auth = auth;
776
776
777
777
req. handle_phase = HandlePhase :: PostAuth ;
@@ -826,9 +826,9 @@ impl Handler for TokenStore {
826
826
if let Some ( auth) = resp. auth . as_mut ( ) {
827
827
if is_unauth_path {
828
828
let source = self . router . matching_mount ( & req. path ) ?;
829
- let source = source. as_str ( ) . trim_start_matches ( AUTH_ROUTER_PREFIX ) . replace ( "/" , "-" ) ;
830
- auth. display_name = ( source + & auth. display_name ) . trim_end_matches ( "-" ) . to_string ( ) ;
831
- req. name = auth. display_name . clone ( ) ;
829
+ let source = source. as_str ( ) . trim_start_matches ( AUTH_ROUTER_PREFIX ) . replace ( '/' , "-" ) ;
830
+ auth. display_name = ( source + & auth. display_name ) . trim_end_matches ( '-' ) . to_string ( ) ;
831
+ req. name . clone_from ( & auth. display_name ) ;
832
832
} else if !req. path . starts_with ( "auth/token/" ) {
833
833
return Err ( RvError :: ErrPermissionDenied ) ;
834
834
}
@@ -852,7 +852,7 @@ impl Handler for TokenStore {
852
852
SystemTime :: now ( ) ,
853
853
) ?;
854
854
855
- auth. token_policies = auth. policies . clone ( ) ;
855
+ auth. token_policies . clone_from ( & auth. policies ) ;
856
856
sanitize_policies ( & mut auth. token_policies , !auth. no_default_policy ) ;
857
857
858
858
let all_policies = auth. token_policies . clone ( ) ;
@@ -876,7 +876,7 @@ impl Handler for TokenStore {
876
876
877
877
self . create ( & mut te) ?;
878
878
879
- auth. client_token = te. id . clone ( ) ;
879
+ auth. client_token . clone_from ( & te. id ) ;
880
880
auth. ttl = Duration :: from_secs ( te. ttl ) ;
881
881
882
882
self . expiration . register_auth ( & te, auth) ?;
0 commit comments