fix: no more Registering progress handler for token rustAnalyzer/Indexing failed.

This commit is contained in:
Aleksey Kladov 2021-04-20 22:54:05 +03:00
parent ad131049c4
commit cdfe5a8be0
2 changed files with 13 additions and 2 deletions

View file

@ -179,6 +179,18 @@ where
start..start + len
}
pub fn defer<F: FnOnce()>(f: F) -> impl Drop {
struct D<F: FnOnce()>(Option<F>);
impl<F: FnOnce()> Drop for D<F> {
fn drop(&mut self) {
if let Some(f) = self.0.take() {
f()
}
}
}
D(Some(f))
}
#[repr(transparent)]
pub struct JodChild(pub std::process::Child);