From a36769b11a5a00f37a5416f917820955860b3a88 Mon Sep 17 00:00:00 2001 From: Lukas Wagner Date: Tue, 8 Aug 2023 10:01:52 +0200 Subject: [PATCH] clippy fix: complex type definitions Signed-off-by: Lukas Wagner --- proxmox-apt/src/repositories/mod.rs | 20 +++++++++----------- proxmox-schema/src/property_string.rs | 6 +++--- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/proxmox-apt/src/repositories/mod.rs b/proxmox-apt/src/repositories/mod.rs index b2e83a0c..45adc85f 100644 --- a/proxmox-apt/src/repositories/mod.rs +++ b/proxmox-apt/src/repositories/mod.rs @@ -113,21 +113,19 @@ pub fn standard_repositories( result } +/// Type containing successfully parsed files, a list of errors for files that +/// could not be read and a common digest for the successfully parsed files. +pub type Repositories = ( + Vec, + Vec, + [u8; 32], +); + /// Returns all APT repositories configured in `/etc/apt/sources.list` and /// in `/etc/apt/sources.list.d` including disabled repositories. /// -/// Returns the succesfully parsed files, a list of errors for files that could -/// not be read or parsed and a common digest for the succesfully parsed files. -/// /// The digest is guaranteed to be set for each successfully parsed file. -pub fn repositories() -> Result< - ( - Vec, - Vec, - [u8; 32], - ), - Error, -> { +pub fn repositories() -> Result { let to_result = |files: Vec, errors: Vec| { let common_digest = common_digest(&files); diff --git a/proxmox-schema/src/property_string.rs b/proxmox-schema/src/property_string.rs index 36bc0e77..7dd60f76 100644 --- a/proxmox-schema/src/property_string.rs +++ b/proxmox-schema/src/property_string.rs @@ -40,10 +40,10 @@ impl<'a> Iterator for PropertyIterator<'a> { } } +type NextProperty<'a> = (Option<&'a str>, Cow<'a, str>, &'a str); + /// Returns an optional key, its value, and the remainder of `data`. -pub(crate) fn next_property( - mut data: &str, -) -> Option, Cow, &str), Error>> { +pub(crate) fn next_property(mut data: &str) -> Option> { if data.is_empty() { return None; }