From 343562c54d70b9ad6bc186d6fa15f2bc4a1734bf Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 1 Jun 2022 21:20:54 +0200 Subject: [PATCH] minor: Fix rustfmt failing on main_loop.rs --- crates/rust-analyzer/src/main_loop.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 0fc5fd9dfa..babcbb4782 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -665,11 +665,11 @@ impl GlobalState { })? .on::(|this, params| { if let Ok(path) = from_proto::vfs_path(¶ms.text_document.uri) { - if this + let already_exists = this .mem_docs .insert(path.clone(), DocumentData::new(params.text_document.version)) - .is_err() - { + .is_err(); + if already_exists { tracing::error!("duplicate DidOpenTextDocument: {}", path) } this.vfs @@ -688,7 +688,7 @@ impl GlobalState { doc.version = params.text_document.version; } None => { - tracing::error!("unexpected DidChangeTextDocument: {}; send DidOpenTextDocument first", path); + tracing::error!("unexpected DidChangeTextDocument: {}", path); return Ok(()); } }; @@ -722,7 +722,8 @@ impl GlobalState { } if let Ok(abs_path) = from_proto::abs_path(¶ms.text_document.uri) { if reload::should_refresh_for_change(&abs_path, ChangeKind::Modify) { - this.fetch_workspaces_queue.request_op(format!("DidSaveTextDocument {}", abs_path.display())); + this.fetch_workspaces_queue + .request_op(format!("DidSaveTextDocument {}", abs_path.display())); } } Ok(()) @@ -751,7 +752,10 @@ impl GlobalState { // provide a configuration. This is handled in Config::update below. let mut config = Config::clone(&*this.config); if let Err(error) = config.update(json.take()) { - this.show_message(lsp_types::MessageType::WARNING, error.to_string()); + this.show_message( + lsp_types::MessageType::WARNING, + error.to_string(), + ); } this.update_configuration(config); }