From 1329dd4e287c137ec0a90abeec0272275b2b2c8d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 2 Sep 2018 15:18:43 +0300 Subject: Avoid clones --- crates/server/src/main_loop/mod.rs | 10 +++++----- crates/server/tests/heavy_tests/support.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'crates/server') diff --git a/crates/server/src/main_loop/mod.rs b/crates/server/src/main_loop/mod.rs index 52fc00c9c..bb1d638e0 100644 --- a/crates/server/src/main_loop/mod.rs +++ b/crates/server/src/main_loop/mod.rs @@ -130,7 +130,7 @@ fn main_loop_inner( Event::Ws(ws) => { match ws { Ok(ws) => { - let not = RawNotification::new::(vec![ws.clone()]); + let not = RawNotification::new::(&vec![ws.clone()]); msg_sender.send(RawMessage::Notification(not)); state.set_workspaces(vec![ws]); state_changed = true; @@ -288,7 +288,7 @@ fn on_notification( let file_id = state.remove_mem_file(path.as_path())?; subs.remove_sub(file_id); let params = req::PublishDiagnosticsParams { uri, diagnostics: Vec::new() }; - let not = RawNotification::new::(params); + let not = RawNotification::new::(¶ms); msg_sender.send(RawMessage::Notification(not)); return Ok(()) } @@ -326,7 +326,7 @@ impl<'a> PoolDispatcher<'a> { let sender = self.sender.clone(); self.pool.execute(move || { let resp = match f(world, params, token) { - Ok(resp) => RawResponse::ok::(id, resp), + Ok(resp) => RawResponse::ok::(id, &resp), Err(e) => RawResponse::err(id, ErrorCode::InternalError as i32, e.to_string()), }; let task = Task::Respond(resp); @@ -363,7 +363,7 @@ fn update_file_notifications_on_threadpool( error!("failed to compute diagnostics: {:?}", e) } Ok(params) => { - let not = RawNotification::new::(params); + let not = RawNotification::new::(¶ms); sender.send(Task::Notify(not)); } } @@ -372,7 +372,7 @@ fn update_file_notifications_on_threadpool( error!("failed to compute decorations: {:?}", e) } Ok(params) => { - let not = RawNotification::new::(params); + let not = RawNotification::new::(¶ms); sender.send(Task::Notify(not)) } } diff --git a/crates/server/tests/heavy_tests/support.rs b/crates/server/tests/heavy_tests/support.rs index 006926216..76cbd56ea 100644 --- a/crates/server/tests/heavy_tests/support.rs +++ b/crates/server/tests/heavy_tests/support.rs @@ -83,7 +83,7 @@ impl Server { }; for (path, text) in files { res.send_notification(RawNotification::new::( - DidOpenTextDocumentParams { + &DidOpenTextDocumentParams { text_document: TextDocumentItem { uri: Url::from_file_path(path).unwrap(), language_id: "rust".to_string(), @@ -149,7 +149,7 @@ impl Server { R: Request, R::Params: Serialize, { - let r = RawRequest::new::(id, params); + let r = RawRequest::new::(id, ¶ms); self.sender.as_ref() .unwrap() .send(RawMessage::Request(r)); -- cgit v1.2.3