diff options
author | Muhammad Mominul Huque <[email protected]> | 2019-06-15 08:37:15 +0100 |
---|---|---|
committer | Muhammad Mominul Huque <[email protected]> | 2019-06-15 08:37:15 +0100 |
commit | ebb40c7f87d58fb74c8f3b4dfcb2704140599d65 (patch) | |
tree | a5446456867754ef3bd533f3b54c7ea1022f9cc4 | |
parent | f032eeb05f0b7d77e30cd6c5eea016cc5d649e3f (diff) |
cargo format
-rw-r--r-- | crates/gen_lsp_server/src/lib.rs | 3 | ||||
-rw-r--r-- | crates/gen_lsp_server/src/msg.rs | 3 | ||||
-rw-r--r-- | crates/ra_batch/src/lib.rs | 1 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 9 |
4 files changed, 4 insertions, 12 deletions
diff --git a/crates/gen_lsp_server/src/lib.rs b/crates/gen_lsp_server/src/lib.rs index 7c4fbbee4..8e7697ed4 100644 --- a/crates/gen_lsp_server/src/lib.rs +++ b/crates/gen_lsp_server/src/lib.rs | |||
@@ -127,8 +127,7 @@ fn initialize( | |||
127 | sender.send(RawMessage::Response(resp)).unwrap(); | 127 | sender.send(RawMessage::Response(resp)).unwrap(); |
128 | match receiver.recv() { | 128 | match receiver.recv() { |
129 | Ok(RawMessage::Notification(n)) => { | 129 | Ok(RawMessage::Notification(n)) => { |
130 | n.cast::<Initialized>() | 130 | n.cast::<Initialized>().map_err(|_| "expected initialized notification")?; |
131 | .map_err(|_| "expected initialized notification")?; | ||
132 | } | 131 | } |
133 | _ => Err(format!("expected initialized notification"))?, | 132 | _ => Err(format!("expected initialized notification"))?, |
134 | } | 133 | } |
diff --git a/crates/gen_lsp_server/src/msg.rs b/crates/gen_lsp_server/src/msg.rs index 8138b84eb..2928e4f8b 100644 --- a/crates/gen_lsp_server/src/msg.rs +++ b/crates/gen_lsp_server/src/msg.rs | |||
@@ -182,8 +182,7 @@ fn read_msg_text(inp: &mut impl BufRead) -> Result<Option<String>> { | |||
182 | } | 182 | } |
183 | let mut parts = buf.splitn(2, ": "); | 183 | let mut parts = buf.splitn(2, ": "); |
184 | let header_name = parts.next().unwrap(); | 184 | let header_name = parts.next().unwrap(); |
185 | let header_value = | 185 | let header_value = parts.next().ok_or_else(|| format!("malformed header: {:?}", buf))?; |
186 | parts.next().ok_or_else(|| format!("malformed header: {:?}", buf))?; | ||
187 | if header_name == "Content-Length" { | 186 | if header_name == "Content-Length" { |
188 | size = Some(header_value.parse::<usize>()?); | 187 | size = Some(header_value.parse::<usize>()?); |
189 | } | 188 | } |
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs index 35e783b14..96b32d9fe 100644 --- a/crates/ra_batch/src/lib.rs +++ b/crates/ra_batch/src/lib.rs | |||
@@ -2,7 +2,6 @@ mod vfs_filter; | |||
2 | 2 | ||
3 | use std::{sync::Arc, path::Path, collections::HashSet, error::Error}; | 3 | use std::{sync::Arc, path::Path, collections::HashSet, error::Error}; |
4 | 4 | ||
5 | |||
6 | use rustc_hash::FxHashMap; | 5 | use rustc_hash::FxHashMap; |
7 | 6 | ||
8 | use ra_db::{ | 7 | use ra_db::{ |
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index fe6b360d4..aeb8a2299 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
@@ -399,8 +399,7 @@ fn on_notification( | |||
399 | Ok(mut params) => { | 399 | Ok(mut params) => { |
400 | let uri = params.text_document.uri; | 400 | let uri = params.text_document.uri; |
401 | let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?; | 401 | let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?; |
402 | let text = | 402 | let text = params.content_changes.pop().ok_or_else(|| format!("empty changes"))?.text; |
403 | params.content_changes.pop().ok_or_else(|| format!("empty changes"))?.text; | ||
404 | state.vfs.write().change_file_overlay(path.as_path(), text); | 403 | state.vfs.write().change_file_overlay(path.as_path(), text); |
405 | return Ok(()); | 404 | return Ok(()); |
406 | } | 405 | } |
@@ -548,11 +547,7 @@ where | |||
548 | error: None, | 547 | error: None, |
549 | } | 548 | } |
550 | } else { | 549 | } else { |
551 | RawResponse::err( | 550 | RawResponse::err(id, ErrorCode::InternalError as i32, e.to_string()) |
552 | id, | ||
553 | ErrorCode::InternalError as i32, | ||
554 | e.to_string() | ||
555 | ) | ||
556 | } | 551 | } |
557 | } | 552 | } |
558 | }, | 553 | }, |