remove 'async move' block; instead, just iterate through issues directly
use anyhow::Context;
use async_trait::async_trait;
use chrono::{DateTime, FixedOffset, Utc};
-use futures::future::try_join_all;
use futures::{future::BoxFuture, FutureExt};
use hyper::header::HeaderValue;
use once_cell::sync::OnceCell;
@@ -1066,12 +1065,11 @@ impl<'q> IssuesQuery for Query<'q> {
.await
.with_context(|| "Unable to get issues.")?;
- let issues_decorator: Vec<_> = issues
- .iter()
- .map(|issue| async move {
- let fcp_details = if include_fcp_details {
- // TODO: this seems like a *really* bad approach, but I'm not sure how to make it better
let fcp_map = crate::rfcbot::get_all_fcps().await?;
+
+ let mut issues_decorator = Vec::new();
+ for issue in issues {
+ let fcp_details = if include_fcp_details {
let repository_name = if let Some(repo) = issue.repository.get() {
repo.repository.clone()
} else {
@@ -1108,7 +1106,7 @@ impl<'q> IssuesQuery for Query<'q> {
} else {
None
};
- Ok(crate::actions::IssueDecorator {
+ issues_decorator.push(crate::actions::IssueDecorator {
title: issue.title.clone(),
number: issue.number,
html_url: issue.html_url.clone(),
@@ -1127,11 +1125,10 @@ impl<'q> IssuesQuery for Query<'q> {
.join(", "),
updated_at: crate::actions::to_human(issue.updated_at),
fcp_details,
- })
- })
- .collect();
+ });
+ }
- try_join_all(issues_decorator).await
+ Ok(issues_decorator)
}
}
