From 06a883e32f097398ec3348524555c0fde45fe24a Mon Sep 17 00:00:00 2001 From: mo8it Date: Thu, 29 Feb 2024 16:05:26 +0100 Subject: [PATCH] Take a reference instead of cloning --- lib/lsp-server/src/req_queue.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/lsp-server/src/req_queue.rs b/lib/lsp-server/src/req_queue.rs index 7b47f5388b..347a9fb6fb 100644 --- a/lib/lsp-server/src/req_queue.rs +++ b/lib/lsp-server/src/req_queue.rs @@ -37,7 +37,7 @@ impl Incoming { } pub fn cancel(&mut self, id: RequestId) -> Option { - let _data = self.complete(id.clone())?; + let _data = self.complete(&id)?; let error = ResponseError { code: ErrorCode::RequestCanceled as i32, message: "canceled by client".to_owned(), @@ -46,8 +46,8 @@ impl Incoming { Some(Response { id, result: None, error: Some(error) }) } - pub fn complete(&mut self, id: RequestId) -> Option { - self.pending.remove(&id) + pub fn complete(&mut self, id: &RequestId) -> Option { + self.pending.remove(id) } pub fn is_completed(&self, id: &RequestId) -> bool {