mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-17 09:33:38 -05:00
Remove used async keyword from 2 functions in Image
This commit is contained in:
13
src/check.rs
13
src/check.rs
@@ -24,13 +24,12 @@ pub async fn get_updates(references: &Option<Vec<String>>, config: &Config) -> V
|
||||
.iter()
|
||||
.filter(|&reference| !image_refs.contains(reference))
|
||||
.collect::<Vec<&String>>();
|
||||
let mut handles = Vec::with_capacity(extra.len());
|
||||
|
||||
for reference in extra {
|
||||
let future = Image::from_reference(reference);
|
||||
handles.push(future)
|
||||
}
|
||||
Some(join_all(handles).await)
|
||||
Some(
|
||||
extra
|
||||
.iter()
|
||||
.map(|reference| Image::from_reference(reference))
|
||||
.collect::<Vec<Image>>(),
|
||||
)
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
|
||||
@@ -41,14 +41,9 @@ pub async fn get_images_from_docker_daemon(
|
||||
.filter(|inspect| inspect.is_ok())
|
||||
.map(|inspect| inspect.as_ref().unwrap().clone())
|
||||
.collect();
|
||||
let mut image_handles = Vec::with_capacity(inspects.len());
|
||||
for inspect in inspects {
|
||||
image_handles.push(Image::from_inspect_data(inspect));
|
||||
}
|
||||
join_all(image_handles)
|
||||
.await
|
||||
inspects
|
||||
.iter()
|
||||
.filter_map(|img| img.clone())
|
||||
.filter_map(|inspect| Image::from_inspect_data(inspect.clone()))
|
||||
.collect()
|
||||
}
|
||||
None => {
|
||||
@@ -58,14 +53,9 @@ pub async fn get_images_from_docker_daemon(
|
||||
error!("Failed to retrieve list of images available!\n{}", e)
|
||||
}
|
||||
};
|
||||
let mut handles = Vec::new();
|
||||
for image in images {
|
||||
handles.push(Image::from_inspect_data(image))
|
||||
}
|
||||
join_all(handles)
|
||||
.await
|
||||
images
|
||||
.iter()
|
||||
.filter_map(|img| img.clone())
|
||||
.filter_map(|image| Image::from_inspect_data(image.clone()))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ pub struct Image {
|
||||
|
||||
impl Image {
|
||||
/// Creates and populates the fields of an Image object based on the ImageSummary from the Docker daemon
|
||||
pub async fn from_inspect_data<T: InspectData>(image: T) -> Option<Self> {
|
||||
pub fn from_inspect_data<T: InspectData>(image: T) -> Option<Self> {
|
||||
let tags = image.tags().unwrap();
|
||||
let digests = image.digests().unwrap();
|
||||
if !tags.is_empty() && !digests.is_empty() {
|
||||
@@ -74,7 +74,7 @@ impl Image {
|
||||
}
|
||||
|
||||
/// Creates and populates the fields of an Image object based on a reference. If the tag is not recognized as a version string, exits the program with an error.
|
||||
pub async fn from_reference(reference: &str) -> Self {
|
||||
pub fn from_reference(reference: &str) -> Self {
|
||||
let (registry, repository, tag) = split(reference);
|
||||
let version_tag = Version::from_tag(&tag);
|
||||
match version_tag {
|
||||
|
||||
Reference in New Issue
Block a user