refactor: use try_next() when processing FETCH responses

This commit is contained in:
link2xt
2025-07-20 13:29:16 +00:00
committed by l
parent 45d8566ec0
commit cac04f8ee4

View File

@@ -1384,14 +1384,15 @@ impl Session {
// Try to find a requested UID in returned FETCH responses.
while fetch_response.is_none() {
let Some(next_fetch_response) = fetch_responses.next().await else {
let Some(next_fetch_response) = fetch_responses
.try_next()
.await
.context("Failed to process IMAP FETCH result")?
else {
// No more FETCH responses received from the server.
break;
};
let next_fetch_response =
next_fetch_response.context("Failed to process IMAP FETCH result")?;
if let Some(next_uid) = next_fetch_response.uid {
if next_uid == request_uid {
fetch_response = Some(next_fetch_response);