From aa9aed2621c1efa2448928f86a18150ebe301ef0 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 10 Jul 2023 16:24:39 +0200 Subject: [PATCH] fmt --- src/config.rs | 22 ++++++++++++---------- src/protocol/verification.rs | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/config.rs b/src/config.rs index 29ac968..bd2f675 100644 --- a/src/config.rs +++ b/src/config.rs @@ -114,9 +114,9 @@ impl FederationConfig { verify_domains_match(activity.id(), activity.actor())?; self.verify_url_valid(activity.id()).await?; if self.is_local_url(activity.id()) { - return Err(Error::UrlVerificationError( - anyhow!("Activity was sent from local instance"), - )); + return Err(Error::UrlVerificationError(anyhow!( + "Activity was sent from local instance" + ))); } Ok(()) @@ -139,9 +139,9 @@ impl FederationConfig { "https" => {} "http" => { if !self.allow_http_urls { - return Err(Error::UrlVerificationError( - anyhow!("Http urls are only allowed in debug mode"), - )); + return Err(Error::UrlVerificationError(anyhow!( + "Http urls are only allowed in debug mode" + ))); } } _ => return Err(Error::UrlVerificationError(anyhow!("Invalid url scheme"))), @@ -153,13 +153,15 @@ impl FederationConfig { } if url.domain().is_none() { - return Err(Error::UrlVerificationError(anyhow!("Url must have a domain"))); + return Err(Error::UrlVerificationError(anyhow!( + "Url must have a domain" + ))); } if url.domain() == Some("localhost") && !self.debug { - return Err(Error::UrlVerificationError( - anyhow!("Localhost is only allowed in debug mode"), - )); + return Err(Error::UrlVerificationError(anyhow!( + "Localhost is only allowed in debug mode" + ))); } self.url_verifier diff --git a/src/protocol/verification.rs b/src/protocol/verification.rs index ed4be30..3383bd9 100644 --- a/src/protocol/verification.rs +++ b/src/protocol/verification.rs @@ -1,7 +1,7 @@ //! Verify that received data is valid +use crate::error::Error; use anyhow::anyhow; -use crate::error::{Error}; use url::Url; /// Check that both urls have the same domain. If not, return UrlVerificationError.