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
|
@ -9,6 +9,7 @@ use regex::Regex;
|
|||
use smol::fs::{self, File};
|
||||
use std::{any::Any, borrow::Cow, env::consts, path::PathBuf, str, sync::Arc};
|
||||
use util::{
|
||||
async_maybe,
|
||||
fs::remove_matching,
|
||||
github::{latest_github_release, GitHubLspBinaryVersion},
|
||||
ResultExt,
|
||||
|
@ -272,7 +273,7 @@ impl LspAdapter for RustLspAdapter {
|
|||
}
|
||||
|
||||
async fn get_cached_server_binary(container_dir: PathBuf) -> Option<LanguageServerBinary> {
|
||||
(|| async move {
|
||||
async_maybe!({
|
||||
let mut last = None;
|
||||
let mut entries = fs::read_dir(&container_dir).await?;
|
||||
while let Some(entry) = entries.next().await {
|
||||
|
@ -283,7 +284,7 @@ async fn get_cached_server_binary(container_dir: PathBuf) -> Option<LanguageServ
|
|||
path: last.ok_or_else(|| anyhow!("no cached binary"))?,
|
||||
arguments: Default::default(),
|
||||
})
|
||||
})()
|
||||
})
|
||||
.await
|
||||
.log_err()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue