aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_proc_macro_srv/src/cli.rs15
-rw-r--r--crates/rust-analyzer/src/bin/main.rs2
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};
4use ra_proc_macro::msg::{self, Message}; 4use ra_proc_macro::msg::{self, Message};
5use std::io; 5use std::io;
6 6
7pub fn run() { 7pub 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
38fn read_request() -> io::Result<Option<msg::Request>> { 31fn 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
68fn run_proc_macro_srv() -> Result<()> { 68fn 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