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:
parent
5b9cc26194
commit
bbdf401a78
14 changed files with 55 additions and 44 deletions
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue