Use async_maybe! instead of inline IIFEs (#6906)

This PR replaces instances where we were using an async IIFE with the
`async_maybe!` macro.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-01-27 20:49:56 -05:00 committed by GitHub
parent 5b9cc26194
commit bbdf401a78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 55 additions and 44 deletions

View file

@ -14,7 +14,7 @@ use std::{
path::{Path, PathBuf},
sync::Arc,
};
use util::ResultExt;
use util::{async_maybe, ResultExt};
const SERVER_PATH: &'static str = "node_modules/.bin/tailwindcss-language-server";
@ -135,7 +135,7 @@ async fn get_cached_server_binary(
container_dir: PathBuf,
node: &dyn NodeRuntime,
) -> Option<LanguageServerBinary> {
(|| async move {
async_maybe!({
let mut last_version_dir = None;
let mut entries = fs::read_dir(&container_dir).await?;
while let Some(entry) = entries.next().await {
@ -157,7 +157,7 @@ async fn get_cached_server_binary(
last_version_dir
))
}
})()
})
.await
.log_err()
}