Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

lint: fix formatting and wasm http error match

Neeraj Guptadfd7a3e8704d
diff --git a/rust/cli/src/api/auth.rs b/rust/cli/src/api/auth.rs
index 1481136596..7ed119b8ac 100644
--- a/rust/cli/src/api/auth.rs
+++ b/rust/cli/src/api/auth.rs
@@ -46,7 +46,11 @@ impl<'a> AuthClient<'a> {
client_public: &[u8],
) -> Result<CreateSrpSessionResponse> {
let client = shared_client(self.api, None)?;
- convert(client.create_srp_session(srp_user_id, client_public).await?)
+ convert(
+ client
+ .create_srp_session(srp_user_id, client_public)
+ .await?,
+ )
}
pub async fn verify_srp_session(
@@ -156,6 +160,9 @@ impl<'a> AuthClient<'a> {
encrypted_two_factor_secret: request.encrypted_two_factor_secret.clone(),
two_factor_secret_decryption_nonce: request.two_factor_secret_decryption_nonce.clone(),
};
- client.enable_two_factor(&request).await.map_err(Error::from)
+ client
+ .enable_two_factor(&request)
+ .await
+ .map_err(Error::from)
}
}
diff --git a/rust/cli/src/auth_flow.rs b/rust/cli/src/auth_flow.rs
index 180c2cb2a9..6626da67c9 100644
--- a/rust/cli/src/auth_flow.rs
+++ b/rust/cli/src/auth_flow.rs
@@ -19,7 +19,11 @@ where
serde_json::from_value(serde_json::to_value(value)?).map_err(Error::from)
}
-fn shared_client(api_client: &ApiClient, app: App, account_id: Option<&str>) -> Result<shared::AccountsClient> {
+fn shared_client(
+ api_client: &ApiClient,
+ app: App,
+ account_id: Option<&str>,
+) -> Result<shared::AccountsClient> {
let mut config = shared::AccountsClientConfig::new(app.client_package())
.with_base_url(api_client.base_url().to_string())
.with_user_agent(format!("ente-rs/{}", env!("CARGO_PKG_VERSION")));
@@ -76,7 +80,12 @@ struct UiAdapter<'a, U> {
}
impl<U: AuthFlowUi> shared::AuthFlowUi for UiAdapter<'_, U> {
- fn read_email_otp(&mut self, email: &str, purpose: OtpPurpose, resent: bool) -> shared::Result<String> {
+ fn read_email_otp(
+ &mut self,
+ email: &str,
+ purpose: OtpPurpose,
+ resent: bool,
+ ) -> shared::Result<String> {
self.inner
.read_email_otp(email, purpose, resent)
.map_err(to_shared_error)
@@ -225,7 +234,11 @@ where
U: AuthFlowUi,
{
pub fn new(api_client: &'a ApiClient, app: App, ui: &'a mut U) -> Self {
- Self { api_client, app, ui }
+ Self {
+ api_client,
+ app,
+ ui,
+ }
}
pub async fn create_account(
diff --git a/rust/cli/src/models/error.rs b/rust/cli/src/models/error.rs
index 34dfd1fbf4..628c67e5c3 100644
--- a/rust/cli/src/models/error.rs
+++ b/rust/cli/src/models/error.rs
@@ -1,5 +1,5 @@
-use ente_core::{auth::AuthError, crypto::CryptoError};
use ente_accounts::Error as AccountsError;
+use ente_core::{auth::AuthError, crypto::CryptoError};
use thiserror::Error;
#[derive(Error, Debug)]
diff --git a/rust/core/src/http.rs b/rust/core/src/http.rs
index f1a53251f5..bf6dac50eb 100644
--- a/rust/core/src/http.rs
+++ b/rust/core/src/http.rs
@@ -898,7 +898,8 @@ mod tests {
#[test]
fn test_parse_api_error_body_prefers_message_and_preserves_code() {
- let (code, message) = parse_api_error_body(r#"{"code":"TOO_MANY_WRONG_ATTEMPTS","message":"wait"}"#);
+ let (code, message) =
+ parse_api_error_body(r#"{"code":"TOO_MANY_WRONG_ATTEMPTS","message":"wait"}"#);
assert_eq!(code.as_deref(), Some("TOO_MANY_WRONG_ATTEMPTS"));
assert_eq!(message, "wait");
}
diff --git a/web/packages/wasm/src/http.rs b/web/packages/wasm/src/http.rs
index 02fe0f3c4e..7ee6731da7 100644
--- a/web/packages/wasm/src/http.rs
+++ b/web/packages/wasm/src/http.rs
@@ -45,7 +45,9 @@ impl From<CoreError> for HttpError {
message,
status: None,
},
- CoreError::Http { status, message } => HttpError {
+ CoreError::Http {
+ status, message, ..
+ } => HttpError {
code: "http".to_string(),
message,
status: Some(status),