aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_proc_macro_srv/src/cli.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/ra_proc_macro_srv/src/cli.rs b/crates/ra_proc_macro_srv/src/cli.rs
index ded1bcdbc..7282e5b9b 100644
--- a/crates/ra_proc_macro_srv/src/cli.rs
+++ b/crates/ra_proc_macro_srv/src/cli.rs
@@ -5,14 +5,7 @@ use ra_proc_macro::msg::{self, Message};
5use std::io; 5use std::io;
6 6
7pub fn run() -> io::Result<()> { 7pub fn run() -> io::Result<()> {
8 loop { 8 while let Some(req) = read_request()? {
9 // bubble up the error for read request,
10 // as the stdin pipe may be closed.
11 let req = match read_request()? {
12 None => continue,
13 Some(req) => req,
14 };
15
16 let res = match req { 9 let res = match req {
17 msg::Request::ListMacro(task) => Ok(msg::Response::ListMacro(list_macros(&task))), 10 msg::Request::ListMacro(task) => Ok(msg::Response::ListMacro(list_macros(&task))),
18 msg::Request::ExpansionMacro(task) => { 11 msg::Request::ExpansionMacro(task) => {
@@ -31,6 +24,8 @@ pub fn run() -> io::Result<()> {
31 eprintln!("Write message error: {}", err); 24 eprintln!("Write message error: {}", err);
32 } 25 }
33 } 26 }
27
28 Ok(())
34} 29}
35 30
36fn read_request() -> io::Result<Option<msg::Request>> { 31fn read_request() -> io::Result<Option<msg::Request>> {