Skip to content

Commit 343562c

Browse files
committed
minor: Fix rustfmt failing on main_loop.rs
1 parent 4f5c7aa commit 343562c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

crates/rust-analyzer/src/main_loop.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -665,11 +665,11 @@ impl GlobalState {
665665
})?
666666
.on::<lsp_types::notification::DidOpenTextDocument>(|this, params| {
667667
if let Ok(path) = from_proto::vfs_path(&params.text_document.uri) {
668-
if this
668+
let already_exists = this
669669
.mem_docs
670670
.insert(path.clone(), DocumentData::new(params.text_document.version))
671-
.is_err()
672-
{
671+
.is_err();
672+
if already_exists {
673673
tracing::error!("duplicate DidOpenTextDocument: {}", path)
674674
}
675675
this.vfs
@@ -688,7 +688,7 @@ impl GlobalState {
688688
doc.version = params.text_document.version;
689689
}
690690
None => {
691-
tracing::error!("unexpected DidChangeTextDocument: {}; send DidOpenTextDocument first", path);
691+
tracing::error!("unexpected DidChangeTextDocument: {}", path);
692692
return Ok(());
693693
}
694694
};
@@ -722,7 +722,8 @@ impl GlobalState {
722722
}
723723
if let Ok(abs_path) = from_proto::abs_path(&params.text_document.uri) {
724724
if reload::should_refresh_for_change(&abs_path, ChangeKind::Modify) {
725-
this.fetch_workspaces_queue.request_op(format!("DidSaveTextDocument {}", abs_path.display()));
725+
this.fetch_workspaces_queue
726+
.request_op(format!("DidSaveTextDocument {}", abs_path.display()));
726727
}
727728
}
728729
Ok(())
@@ -751,7 +752,10 @@ impl GlobalState {
751752
// provide a configuration. This is handled in Config::update below.
752753
let mut config = Config::clone(&*this.config);
753754
if let Err(error) = config.update(json.take()) {
754-
this.show_message(lsp_types::MessageType::WARNING, error.to_string());
755+
this.show_message(
756+
lsp_types::MessageType::WARNING,
757+
error.to_string(),
758+
);
755759
}
756760
this.update_configuration(config);
757761
}

0 commit comments

Comments
 (0)