From 774a9c331214fc6682c793eb5cf8d666f8774b57 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 6 Apr 2021 11:32:42 +0200 Subject: Run cargo-fmt Signed-off-by: Matthias Beyer --- librepology/src/lib.rs | 16 ++++++++++------ librepology/src/v1/api.rs | 4 +--- librepology/src/v1/buffer.rs | 15 ++++++--------- librepology/src/v1/mod.rs | 6 +++--- librepology/src/v1/restapi.rs | 21 +++++++++++++-------- librepology/src/v1/types/category.rs | 1 - librepology/src/v1/types/download.rs | 1 - librepology/src/v1/types/effname.rs | 1 - librepology/src/v1/types/license.rs | 1 - librepology/src/v1/types/maintainer.rs | 1 - librepology/src/v1/types/mod.rs | 1 - librepology/src/v1/types/name.rs | 1 - librepology/src/v1/types/package.rs | 2 -- librepology/src/v1/types/repo.rs | 1 - librepology/src/v1/types/status.rs | 1 - librepology/src/v1/types/summary.rs | 1 - librepology/src/v1/types/version.rs | 1 - librepology/src/v1/types/www.rs | 1 - 18 files changed, 33 insertions(+), 43 deletions(-) diff --git a/librepology/src/lib.rs b/librepology/src/lib.rs index 514cac4..8ca04da 100644 --- a/librepology/src/lib.rs +++ b/librepology/src/lib.rs @@ -1,13 +1,17 @@ -extern crate thiserror; +extern crate curl; extern crate serde; extern crate serde_json; +extern crate thiserror; extern crate url; extern crate url_serde; -extern crate curl; -#[macro_use] extern crate serde_derive; -#[macro_use] extern crate log; -#[macro_use] extern crate derive_more; -#[macro_use] extern crate derive_new; +#[macro_use] +extern crate serde_derive; +#[macro_use] +extern crate log; +#[macro_use] +extern crate derive_more; +#[macro_use] +extern crate derive_new; pub mod v1; diff --git a/librepology/src/v1/api.rs b/librepology/src/v1/api.rs index 3d659df..1c8cd6e 100644 --- a/librepology/src/v1/api.rs +++ b/librepology/src/v1/api.rs @@ -1,6 +1,6 @@ use crate::v1::error::Result; -use crate::v1::types::Problem; use crate::v1::types::Package; +use crate::v1::types::Problem; /// The high-level functionality of the repology API is represented in this trait /// @@ -17,5 +17,3 @@ pub trait Api { fn problems_for_maintainer>(&self, maintainer: M) -> Result>; } - - diff --git a/librepology/src/v1/buffer.rs b/librepology/src/v1/buffer.rs index 534ab4c..e2eb67a 100644 --- a/librepology/src/v1/buffer.rs +++ b/librepology/src/v1/buffer.rs @@ -1,20 +1,20 @@ use std::io::Read; -use crate::v1::error::Result; +use crate::v1::api::Api; use crate::v1::error::RepologyError as Error; -use crate::v1::types::Problem; +use crate::v1::error::Result; use crate::v1::types::Package; -use crate::v1::api::Api; +use crate::v1::types::Problem; #[derive(Debug)] pub struct BufferApi { buf: String, } -impl BufferApi -{ +impl BufferApi { pub fn read_from(mut input: R) -> Result - where R: Read, + where + R: Read, { let mut buf = String::new(); let read = input.read_to_string(&mut buf)?; @@ -24,7 +24,6 @@ impl BufferApi } impl Api for BufferApi { - fn project>(&self, _name: N) -> Result> { serde_json::de::from_str(&self.buf).map_err(Error::from) } @@ -36,6 +35,4 @@ impl Api for BufferApi { fn problems_for_maintainer>(&self, _maintainer: M) -> Result> { serde_json::de::from_str(&self.buf).map_err(Error::from) } - } - diff --git a/librepology/src/v1/mod.rs b/librepology/src/v1/mod.rs index aa1cd9b..781cc0f 100644 --- a/librepology/src/v1/mod.rs +++ b/librepology/src/v1/mod.rs @@ -1,5 +1,5 @@ -pub mod restapi; -pub mod buffer; pub mod api; -pub mod types; +pub mod buffer; pub mod error; +pub mod restapi; +pub mod types; diff --git a/librepology/src/v1/restapi.rs b/librepology/src/v1/restapi.rs index e9a6cd1..1f68c41 100644 --- a/librepology/src/v1/restapi.rs +++ b/librepology/src/v1/restapi.rs @@ -2,10 +2,10 @@ use std::result::Result as RResult; use curl::easy::Easy2; -use crate::v1::error::Result; +use crate::v1::api::Api; use crate::v1::error::RepologyError as Error; +use crate::v1::error::Result; use crate::v1::types::{Package, Problem}; -use crate::v1::api::Api; /// Private helper type for collecting data from the curl library struct Collector(Vec); @@ -39,27 +39,32 @@ impl RestApi { } impl Api for RestApi { - fn project>(&self, name: N) -> Result> { let url = format!("{}api/v1/project/{}", self.repology, name.as_ref()); trace!("Request: {}", url); let response = self.send_request(url)?; - serde_json::from_str(&response) - .map_err(Error::from) + serde_json::from_str(&response).map_err(Error::from) } fn problems_for_repo>(&self, repo: R) -> Result> { - let url = format!("{}api/v1/repository/{}/problems", self.repology, repo.as_ref()); + let url = format!( + "{}api/v1/repository/{}/problems", + self.repology, + repo.as_ref() + ); trace!("Request: {}", url); let response = self.send_request(url)?; serde_json::from_str(&response).map_err(Error::from) } fn problems_for_maintainer>(&self, maintainer: M) -> Result> { - let url = format!("{}api/v1/maintainer/{}/problems", self.repology, maintainer.as_ref()); + let url = format!( + "{}api/v1/maintainer/{}/problems", + self.repology, + maintainer.as_ref() + ); trace!("Request: {}", url); let response = self.send_request(url)?; serde_json::from_str(&response).map_err(Error::from) } - } diff --git a/librepology/src/v1/types/category.rs b/librepology/src/v1/types/category.rs index 975fe7f..ad118d0 100644 --- a/librepology/src/v1/types/category.rs +++ b/librepology/src/v1/types/category.rs @@ -11,4 +11,3 @@ impl Deref for Category { &self.0 } } - diff --git a/librepology/src/v1/types/download.rs b/librepology/src/v1/types/download.rs index d52a2db..e4d64d1 100644 --- a/librepology/src/v1/types/download.rs +++ b/librepology/src/v1/types/download.rs @@ -13,4 +13,3 @@ impl Deref for Download { &self.0 } } - diff --git a/librepology/src/v1/types/effname.rs b/librepology/src/v1/types/effname.rs index 118f56e..d940b63 100644 --- a/librepology/src/v1/types/effname.rs +++ b/librepology/src/v1/types/effname.rs @@ -11,4 +11,3 @@ impl Deref for EffName { &self.0 } } - diff --git a/librepology/src/v1/types/license.rs b/librepology/src/v1/types/license.rs index f755888..3c5fe4f 100644 --- a/librepology/src/v1/types/license.rs +++ b/librepology/src/v1/types/license.rs @@ -11,4 +11,3 @@ impl Deref for License { &self.0 } } - diff --git a/librepology/src/v1/types/maintainer.rs b/librepology/src/v1/types/maintainer.rs index f97fc91..4dbf506 100644 --- a/librepology/src/v1/types/maintainer.rs +++ b/librepology/src/v1/types/maintainer.rs @@ -11,4 +11,3 @@ impl Deref for Maintainer { &self.0 } } - diff --git a/librepology/src/v1/types/mod.rs b/librepology/src/v1/types/mod.rs index f192c49..434274b 100644 --- a/librepology/src/v1/types/mod.rs +++ b/librepology/src/v1/types/mod.rs @@ -33,4 +33,3 @@ pub use status::Status; pub use summary::Summary; pub use version::Version; pub use www::Www; - diff --git a/librepology/src/v1/types/name.rs b/librepology/src/v1/types/name.rs index 70e3317..0097f99 100644 --- a/librepology/src/v1/types/name.rs +++ b/librepology/src/v1/types/name.rs @@ -11,4 +11,3 @@ impl Deref for Name { &self.0 } } - diff --git a/librepology/src/v1/types/package.rs b/librepology/src/v1/types/package.rs index 4623fd3..1286b15 100644 --- a/librepology/src/v1/types/package.rs +++ b/librepology/src/v1/types/package.rs @@ -96,6 +96,4 @@ impl Package { pub fn downloads(&self) -> Option<&Vec> { self.downloads.as_ref() } - } - diff --git a/librepology/src/v1/types/repo.rs b/librepology/src/v1/types/repo.rs index 062358e..e5ddc87 100644 --- a/librepology/src/v1/types/repo.rs +++ b/librepology/src/v1/types/repo.rs @@ -11,4 +11,3 @@ impl Deref for Repo { &self.0 } } - diff --git a/librepology/src/v1/types/status.rs b/librepology/src/v1/types/status.rs index c42d510..726359e 100644 --- a/librepology/src/v1/types/status.rs +++ b/librepology/src/v1/types/status.rs @@ -41,4 +41,3 @@ pub enum Status { #[display(fmt = "ignored")] Ignored, } - diff --git a/librepology/src/v1/types/summary.rs b/librepology/src/v1/types/summary.rs index 0595fef..b1fc874 100644 --- a/librepology/src/v1/types/summary.rs +++ b/librepology/src/v1/types/summary.rs @@ -11,4 +11,3 @@ impl Deref for Summary { &self.0 } } - diff --git a/librepology/src/v1/types/version.rs b/librepology/src/v1/types/version.rs index 7ae7b85..2350316 100644 --- a/librepology/src/v1/types/version.rs +++ b/librepology/src/v1/types/version.rs @@ -11,4 +11,3 @@ impl Deref for Version { &self.0 } } - diff --git a/librepology/src/v1/types/www.rs b/librepology/src/v1/types/www.rs index 1b5b89e..04507a7 100644 --- a/librepology/src/v1/types/www.rs +++ b/librepology/src/v1/types/www.rs @@ -12,4 +12,3 @@ impl Deref for Www { &self.0 } } - -- cgit v1.2.3