Skip to content

Commit

Permalink
sdk: prefer direct use of IntoHttp ctor instead of implicit `#[from…
Browse files Browse the repository at this point in the history
…]` conversions
  • Loading branch information
bnjbvr committed Jun 17, 2024
1 parent c33a7b7 commit c656ad4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fn response_to_error(status: StatusCode, body: Vec<u8>) -> HttpError {

error.into()
}
Err(e) => e.into(),
Err(e) => HttpError::IntoHttp(e),
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub enum HttpError {

/// An error converting between ruma_client_api types and Hyper types.
#[error(transparent)]
IntoHttp(#[from] IntoHttpError),
IntoHttp(IntoHttpError),

/// An error occurred while refreshing the access token.
#[error(transparent)]
Expand Down
5 changes: 3 additions & 2 deletions crates/matrix-sdk/src/http_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ impl HttpClient {
}
}

let request =
self.serialize_request(request, config, homeserver, access_token, server_versions)?;
let request = self
.serialize_request(request, config, homeserver, access_token, server_versions)
.map_err(HttpError::IntoHttp)?;

let method = request.method();

Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/src/matrix_auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl MatrixAuth {

match request {
Ok(req) => Ok(req.uri().to_string()),
Err(err) => Err(Error::from(HttpError::from(err))),
Err(err) => Err(Error::from(HttpError::IntoHttp(err))),
}
}

Expand Down

0 comments on commit c656ad4

Please sign in to comment.