@@ -144,8 +144,7 @@ impl MatrixAdapter {
144144 && status == reqwest:: StatusCode :: UNAUTHORIZED
145145 && is_unknown_token_body ( & body_text)
146146 {
147- match try_refresh_tokens ( & self . client , & self . homeserver_url , & self . tokens )
148- . await
147+ match try_refresh_tokens ( & self . client , & self . homeserver_url , & self . tokens ) . await
149148 {
150149 Ok ( ( ) ) => {
151150 info ! ( "Matrix: access token refreshed via MSC2918, retrying send" ) ;
@@ -717,7 +716,8 @@ mod tests {
717716 #[ test]
718717 fn test_is_unknown_token_body ( ) {
719718 // Real matrix.org body for M_UNKNOWN_TOKEN under MAS.
720- let body = r#"{"errcode":"M_UNKNOWN_TOKEN","error":"Token is not active","soft_logout":true}"# ;
719+ let body =
720+ r#"{"errcode":"M_UNKNOWN_TOKEN","error":"Token is not active","soft_logout":true}"# ;
721721 assert ! ( is_unknown_token_body( body) ) ;
722722 assert ! ( !is_hard_logout( body) ) ;
723723
@@ -740,19 +740,17 @@ mod tests {
740740 // access and refresh tokens and returns the new pair.
741741 use axum:: { routing:: post, Json , Router } ;
742742
743- async fn refresh_handler (
744- Json ( body) : Json < serde_json:: Value > ,
745- ) -> Json < serde_json:: Value > {
746- let incoming = body
747- . get ( "refresh_token" )
748- . and_then ( |v| v. as_str ( ) )
749- . unwrap_or ( "" ) ;
750- assert_eq ! ( incoming, "old_refresh" ) ;
751- Json ( serde_json:: json!( {
752- "access_token" : "new_access" ,
753- "refresh_token" : "new_refresh" ,
754- "expires_in_ms" : 3_600_000u64 ,
755- } ) )
743+ async fn refresh_handler ( Json ( body) : Json < serde_json:: Value > ) -> Json < serde_json:: Value > {
744+ let incoming = body
745+ . get ( "refresh_token" )
746+ . and_then ( |v| v. as_str ( ) )
747+ . unwrap_or ( "" ) ;
748+ assert_eq ! ( incoming, "old_refresh" ) ;
749+ Json ( serde_json:: json!( {
750+ "access_token" : "new_access" ,
751+ "refresh_token" : "new_refresh" ,
752+ "expires_in_ms" : 3_600_000u64 ,
753+ } ) )
756754 }
757755
758756 let app = Router :: new ( ) . route ( "/_matrix/client/v3/refresh" , post ( refresh_handler) ) ;
@@ -779,10 +777,7 @@ mod tests {
779777 drop ( guard) ;
780778
781779 // Refresh with no refresh token configured must fail cleanly.
782- let no_refresh: TokenPair = Arc :: new ( RwLock :: new ( (
783- Zeroizing :: new ( "a" . to_string ( ) ) ,
784- None ,
785- ) ) ) ;
780+ let no_refresh: TokenPair = Arc :: new ( RwLock :: new ( ( Zeroizing :: new ( "a" . to_string ( ) ) , None ) ) ) ;
786781 let err = try_refresh_tokens ( & client, & homeserver, & no_refresh)
787782 . await
788783 . unwrap_err ( ) ;
0 commit comments