Satisfy clippy.

imgbot
Joe Neeman 3 years ago committed by Blaž Hrastnik
parent d64d75e724
commit ffa2f2590b

@ -167,7 +167,7 @@ impl Application {
} }
self.render(); self.render();
} }
Some(callback) = self.jobs.next() => { Some(callback) = self.jobs.next_job() => {
self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback); self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
self.render(); self.render();
} }

@ -1917,16 +1917,14 @@ fn append_to_line(cx: &mut Context) {
// Creates an LspCallback that waits for formatting changes to be computed. When they're done, // Creates an LspCallback that waits for formatting changes to be computed. When they're done,
// it applies them, but only if the doc hasn't changed. // it applies them, but only if the doc hasn't changed.
fn make_format_callback( async fn make_format_callback(
doc_id: DocumentId, doc_id: DocumentId,
doc_version: i32, doc_version: i32,
set_unmodified: bool, set_unmodified: bool,
format: impl Future<Output = helix_lsp::util::LspFormatting> + Send + 'static, format: impl Future<Output = helix_lsp::util::LspFormatting> + Send + 'static,
) -> impl Future<Output = anyhow::Result<job::Callback>> { ) -> anyhow::Result<job::Callback> {
async move {
let format = format.await; let format = format.await;
let call: job::Callback = let call: job::Callback = Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
let view_id = view!(editor).id; let view_id = view!(editor).id;
if let Some(doc) = editor.document_mut(doc_id) { if let Some(doc) = editor.document_mut(doc_id) {
if doc.version() == doc_version { if doc.version() == doc_version {
@ -1941,7 +1939,6 @@ fn make_format_callback(
} }
}); });
Ok(call) Ok(call)
}
} }
enum Open { enum Open {

@ -33,7 +33,7 @@ impl Job {
f: F, f: F,
) -> Job { ) -> Job {
Job { Job {
future: f.map(|r| r.map(|x| Some(x))).boxed(), future: f.map(|r| r.map(Some)).boxed(),
wait: false, wait: false,
} }
} }
@ -77,9 +77,9 @@ impl Jobs {
} }
} }
pub fn next<'a>( pub fn next_job(
&'a mut self, &mut self,
) -> impl Future<Output = Option<anyhow::Result<Option<Callback>>>> + 'a { ) -> impl Future<Output = Option<anyhow::Result<Option<Callback>>>> + '_ {
future::select(self.futures.next(), self.wait_futures.next()) future::select(self.futures.next(), self.wait_futures.next())
.map(|either| either.factor_first().0) .map(|either| either.factor_first().0)
} }

Loading…
Cancel
Save