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};
|
||||
|
||||
fn intelephense_server_binary_arguments(server_path: &Path) -> Vec<OsString> {
|
||||
vec![server_path.into(), "--stdio".into()]
|
||||
|
@ -108,7 +108,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 {
|
||||
|
@ -130,7 +130,7 @@ async fn get_cached_server_binary(
|
|||
last_version_dir
|
||||
))
|
||||
}
|
||||
})()
|
||||
})
|
||||
.await
|
||||
.log_err()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue