diff options
-rw-r--r-- | crates/ra_proc_macro_srv/src/cli.rs | 15 | ||||
-rw-r--r-- | crates/rust-analyzer/src/bin/main.rs | 2 |
2 files changed, 5 insertions, 12 deletions
diff --git a/crates/ra_proc_macro_srv/src/cli.rs b/crates/ra_proc_macro_srv/src/cli.rs index 5f1f3ba3c..7282e5b9b 100644 --- a/crates/ra_proc_macro_srv/src/cli.rs +++ b/crates/ra_proc_macro_srv/src/cli.rs | |||
@@ -4,17 +4,8 @@ use crate::{expand_task, list_macros}; | |||
4 | use ra_proc_macro::msg::{self, Message}; | 4 | use ra_proc_macro::msg::{self, Message}; |
5 | use std::io; | 5 | use std::io; |
6 | 6 | ||
7 | pub fn run() { | 7 | pub fn run() -> io::Result<()> { |
8 | loop { | 8 | while let Some(req) = read_request()? { |
9 | let req = match read_request() { | ||
10 | Err(err) => { | ||
11 | eprintln!("Read message error on ra_proc_macro_srv: {}", err); | ||
12 | continue; | ||
13 | } | ||
14 | Ok(None) => continue, | ||
15 | Ok(Some(req)) => req, | ||
16 | }; | ||
17 | |||
18 | let res = match req { | 9 | let res = match req { |
19 | msg::Request::ListMacro(task) => Ok(msg::Response::ListMacro(list_macros(&task))), | 10 | msg::Request::ListMacro(task) => Ok(msg::Response::ListMacro(list_macros(&task))), |
20 | msg::Request::ExpansionMacro(task) => { | 11 | msg::Request::ExpansionMacro(task) => { |
@@ -33,6 +24,8 @@ pub fn run() { | |||
33 | eprintln!("Write message error: {}", err); | 24 | eprintln!("Write message error: {}", err); |
34 | } | 25 | } |
35 | } | 26 | } |
27 | |||
28 | Ok(()) | ||
36 | } | 29 | } |
37 | 30 | ||
38 | fn read_request() -> io::Result<Option<msg::Request>> { | 31 | fn read_request() -> io::Result<Option<msg::Request>> { |
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs index e8d5dad65..22a84b50c 100644 --- a/crates/rust-analyzer/src/bin/main.rs +++ b/crates/rust-analyzer/src/bin/main.rs | |||
@@ -66,7 +66,7 @@ fn setup_logging() -> Result<()> { | |||
66 | } | 66 | } |
67 | 67 | ||
68 | fn run_proc_macro_srv() -> Result<()> { | 68 | fn run_proc_macro_srv() -> Result<()> { |
69 | ra_proc_macro_srv::cli::run(); | 69 | ra_proc_macro_srv::cli::run()?; |
70 | Ok(()) | 70 | Ok(()) |
71 | } | 71 | } |
72 | 72 | ||