aboutsummaryrefslogtreecommitdiff
path: root/crates/proc_macro_srv/src/cli.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/proc_macro_srv/src/cli.rs')
-rw-r--r--crates/proc_macro_srv/src/cli.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/proc_macro_srv/src/cli.rs b/crates/proc_macro_srv/src/cli.rs
index d428b9567..bc48f1c43 100644
--- a/crates/proc_macro_srv/src/cli.rs
+++ b/crates/proc_macro_srv/src/cli.rs
@@ -6,8 +6,9 @@ use std::io;
6 6
7pub fn run() -> io::Result<()> { 7pub fn run() -> io::Result<()> {
8 let mut srv = ProcMacroSrv::default(); 8 let mut srv = ProcMacroSrv::default();
9 let mut buf = String::new();
9 10
10 while let Some(req) = read_request()? { 11 while let Some(req) = read_request(&mut buf)? {
11 let res = match req { 12 let res = match req {
12 msg::Request::ListMacro(task) => srv.list_macros(&task).map(msg::Response::ListMacro), 13 msg::Request::ListMacro(task) => srv.list_macros(&task).map(msg::Response::ListMacro),
13 msg::Request::ExpansionMacro(task) => { 14 msg::Request::ExpansionMacro(task) => {
@@ -30,8 +31,8 @@ pub fn run() -> io::Result<()> {
30 Ok(()) 31 Ok(())
31} 32}
32 33
33fn read_request() -> io::Result<Option<msg::Request>> { 34fn read_request(buf: &mut String) -> io::Result<Option<msg::Request>> {
34 msg::Request::read(&mut io::stdin().lock()) 35 msg::Request::read(&mut io::stdin().lock(), buf)
35} 36}
36 37
37fn write_response(msg: msg::Response) -> io::Result<()> { 38fn write_response(msg: msg::Response) -> io::Result<()> {