]> git.proxmox.com Git - proxmox.git/commitdiff
clippy fix: complex type definitions
authorLukas Wagner <l.wagner@proxmox.com>
Tue, 8 Aug 2023 08:01:52 +0000 (10:01 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 8 Aug 2023 09:29:36 +0000 (11:29 +0200)
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
proxmox-apt/src/repositories/mod.rs
proxmox-schema/src/property_string.rs

index b2e83a0c7d0ba9e926c80abfaccafc652a81de0c..45adc85fbeaa591ab876e246259090d658d138bf 100644 (file)
@@ -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<APTRepositoryFile>,
+    Vec<APTRepositoryFileError>,
+    [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<APTRepositoryFile>,
-        Vec<APTRepositoryFileError>,
-        [u8; 32],
-    ),
-    Error,
-> {
+pub fn repositories() -> Result<Repositories, Error> {
     let to_result = |files: Vec<APTRepositoryFile>, errors: Vec<APTRepositoryFileError>| {
         let common_digest = common_digest(&files);
 
index 36bc0e7769b79e33a13ef842380ded496d838c1c..7dd60f762fe88edae2b65b479a62c70f988b2fd5 100644 (file)
@@ -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<Result<(Option<&str>, Cow<str>, &str), Error>> {
+pub(crate) fn next_property(mut data: &str) -> Option<Result<NextProperty, Error>> {
     if data.is_empty() {
         return None;
     }