@@ -525,19 +525,19 @@ impl TokenStore {
525525 if !is_root {
526526 return Err ( RvError :: ErrRequestInvalid ) ;
527527 }
528- te. id = data. id . clone ( ) ;
528+ te. id . clone_from ( & data. id ) ;
529529 }
530530
531531 if data. policies . is_empty ( ) {
532- data. policies = parent. policies . clone ( ) ;
532+ data. policies . clone_from ( & parent. policies ) ;
533533 sanitize_policies ( & mut data. policies , false ) ;
534534 }
535535
536536 if !is_root && !is_str_subset ( & data. policies , & parent. policies ) {
537537 return Err ( RvError :: ErrRequestInvalid ) ;
538538 }
539539
540- te. policies = data. policies . clone ( ) ;
540+ te. policies . clone_from ( & data. policies ) ;
541541
542542 for policy in te. policies . iter ( ) {
543543 if NON_ASSIGNABLE_POLICIES . contains ( & policy. as_str ( ) ) {
@@ -657,7 +657,7 @@ impl TokenStore {
657657 log:: debug!( "lookup token" ) ;
658658 let mut id = req. get_data_as_str ( "token" ) ?;
659659 if id. is_empty ( ) {
660- id = req. client_token . clone ( ) ;
660+ id. clone_from ( & req. client_token ) ;
661661 }
662662
663663 if id. is_empty ( ) {
@@ -771,7 +771,7 @@ impl Handler for TokenStore {
771771 return Err ( RvError :: ErrPermissionDenied ) ;
772772 }
773773
774- req. name = auth. as_ref ( ) . unwrap ( ) . display_name . clone ( ) ;
774+ req. name . clone_from ( & auth. as_ref ( ) . unwrap ( ) . display_name ) ;
775775 req. auth = auth;
776776
777777 req. handle_phase = HandlePhase :: PostAuth ;
@@ -826,9 +826,9 @@ impl Handler for TokenStore {
826826 if let Some ( auth) = resp. auth . as_mut ( ) {
827827 if is_unauth_path {
828828 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 ) ;
832832 } else if !req. path . starts_with ( "auth/token/" ) {
833833 return Err ( RvError :: ErrPermissionDenied ) ;
834834 }
@@ -852,7 +852,7 @@ impl Handler for TokenStore {
852852 SystemTime :: now ( ) ,
853853 ) ?;
854854
855- auth. token_policies = auth. policies . clone ( ) ;
855+ auth. token_policies . clone_from ( & auth. policies ) ;
856856 sanitize_policies ( & mut auth. token_policies , !auth. no_default_policy ) ;
857857
858858 let all_policies = auth. token_policies . clone ( ) ;
@@ -876,7 +876,7 @@ impl Handler for TokenStore {
876876
877877 self . create ( & mut te) ?;
878878
879- auth. client_token = te. id . clone ( ) ;
879+ auth. client_token . clone_from ( & te. id ) ;
880880 auth. ttl = Duration :: from_secs ( te. ttl ) ;
881881
882882 self . expiration . register_auth ( & te, auth) ?;
0 commit comments