Skip to content

Commit

Permalink
fix: rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Leander Beernaert authored and Leander Beernaert committed Aug 3, 2024
1 parent 5b76cd7 commit f173d30
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion you-have-mail-mobile/src/account.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::events::Event;
use chrono::{DateTime, Local};
use you_have_mail_common as yhm;
use crate::events::Event;

/// An account in the system.
#[derive(uniffi::Object)]
Expand Down
7 changes: 4 additions & 3 deletions you-have-mail-mobile/src/backend/proton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ pub struct ProtonLoginSequence {

#[uniffi::export]
impl ProtonLoginSequence {

/// Create new instance.
///
/// # Errors
Expand Down Expand Up @@ -260,12 +259,14 @@ impl ProtonLoginSequence {
/// # Errors
///
/// Returns error if request failed.
pub fn captcha(&self, token:&str) -> Result<String, ProtonLoginError> {
pub fn captcha(&self, token: &str) -> Result<String, ProtonLoginError> {
let mut guard = self.sequence.lock();
let Some(sequence) = guard.take() else {
return Err(ProtonLoginError::Invalid);
};

Ok(sequence.session().execute(GetCaptchaRequest::new(token,false))?)
Ok(sequence
.session()
.execute(GetCaptchaRequest::new(token, false))?)
}
}
17 changes: 7 additions & 10 deletions you-have-mail-mobile/src/proxy.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use tracing::error;
use crate::yhm::YhmError;
use tracing::error;
use you_have_mail_common as yhm;
use you_have_mail_common::backend::proton::proton_api::client::ProtonExtension;
use you_have_mail_common::backend::proton::proton_api::requests::Ping;
Expand All @@ -21,7 +21,7 @@ impl From<yhm::http::ProxyProtocol> for Protocol {
}
}

impl From<Protocol> for yhm::http::ProxyProtocol{
impl From<Protocol> for yhm::http::ProxyProtocol {
fn from(value: Protocol) -> Self {
match value {
Protocol::Http => yhm::http::ProxyProtocol::Http,
Expand Down Expand Up @@ -79,15 +79,14 @@ impl From<yhm::http::Proxy> for Proxy {
}

impl From<Proxy> for yhm::http::Proxy {
fn from(value:Proxy) -> Self {
fn from(value: Proxy) -> Self {
yhm::http::Proxy {
protocol: value.protocol.into(),
host: value.host,
auth: value.auth.map(Into::into),
port: value.port,
}
}

}

/// Test a proxy by constructing a client and trying to ping a server.
Expand All @@ -104,11 +103,9 @@ pub fn test_proxy(proxy: Proxy) -> Result<(), YhmError> {
error!("Failed to build client with proxy: {e}");
YhmError::ProxyTest(e.to_string())
})?;
client
.execute(&Ping {})
.map_err(|e| {
error!("Failed ping server using proxy: {e}");
YhmError::ProxyTest(e.to_string())
})?;
client.execute(&Ping {}).map_err(|e| {
error!("Failed ping server using proxy: {e}");
YhmError::ProxyTest(e.to_string())
})?;
Ok(())
}

0 comments on commit f173d30

Please sign in to comment.