[pbs-devel] [PATCH proxmox 14/15] clippy fix: complex type definitions
Lukas Wagner
l.wagner at proxmox.com
Tue Aug 8 10:01:52 CEST 2023
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
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 b2e83a0..45adc85 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<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);
diff --git a/proxmox-schema/src/property_string.rs b/proxmox-schema/src/property_string.rs
index 36bc0e7..7dd60f7 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<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;
}
--
2.39.2
More information about the pbs-devel
mailing list