From 8395a02832a982cde7be27fcbd960f85a0fb856b Mon Sep 17 00:00:00 2001 From: "Josh (aider)" Date: Tue, 7 Jan 2025 11:56:35 -0600 Subject: [PATCH] fix: Clone URI to avoid borrow-after-move in handle_did_open --- crates/djls-server/src/documents.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/djls-server/src/documents.rs b/crates/djls-server/src/documents.rs index 58b7a66..15affb2 100644 --- a/crates/djls-server/src/documents.rs +++ b/crates/djls-server/src/documents.rs @@ -24,15 +24,16 @@ impl Store { } pub fn handle_did_open(&mut self, params: DidOpenTextDocumentParams, client: &Client) -> Result<()> { + let uri = params.text_document.uri.clone(); // Clone the URI here let document = TextDocument::new( - String::from(params.text_document.uri), + uri.to_string(), // Use the cloned URI params.text_document.text, params.text_document.version, params.text_document.language_id, ); self.add_document(document); - self.publish_diagnostics(params.text_document.uri.as_str(), client); + self.publish_diagnostics(uri.as_str(), client); // Use the cloned URI Ok(()) }