diff options
author | Aleksey Kladov <[email protected]> | 2018-08-12 20:23:44 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-12 20:23:44 +0100 |
commit | 535bd7ccf73bcea549ddb7b01e7b3c4f35c6e856 (patch) | |
tree | cd2c3c11ee38b4f9637dca6c44821fa27f4c6ead /crates/server | |
parent | b518fd0ef91d8ca3d9814b335c7be8684d1692a9 (diff) |
remove useless loop
Diffstat (limited to 'crates/server')
-rw-r--r-- | crates/server/src/main.rs | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/crates/server/src/main.rs b/crates/server/src/main.rs index fccfe9b3b..4b250acfa 100644 --- a/crates/server/src/main.rs +++ b/crates/server/src/main.rs | |||
@@ -72,33 +72,30 @@ fn main_inner() -> Result<()> { | |||
72 | } | 72 | } |
73 | 73 | ||
74 | fn initialize(io: &mut Io) -> Result<()> { | 74 | fn initialize(io: &mut Io) -> Result<()> { |
75 | loop { | 75 | match io.recv()? { |
76 | match io.recv()? { | 76 | RawMsg::Notification(n) => |
77 | RawMsg::Notification(n) => | 77 | bail!("expected initialize request, got {:?}", n), |
78 | bail!("expected initialize request, got {:?}", n), | 78 | RawMsg::Response(res) => |
79 | RawMsg::Response(res) => | 79 | bail!("expected initialize request, got {:?}", res), |
80 | bail!("expected initialize request, got {:?}", res), | ||
81 | 80 | ||
82 | RawMsg::Request(req) => { | 81 | RawMsg::Request(req) => { |
83 | let mut req = Some(req); | 82 | let mut req = Some(req); |
84 | dispatch::handle_request::<req::Initialize, _>(&mut req, |_params, resp| { | 83 | dispatch::handle_request::<req::Initialize, _>(&mut req, |_params, resp| { |
85 | let res = req::InitializeResult { capabilities: caps::SERVER_CAPABILITIES }; | 84 | let res = req::InitializeResult { capabilities: caps::SERVER_CAPABILITIES }; |
86 | let resp = resp.into_response(Ok(res))?; | 85 | let resp = resp.into_response(Ok(res))?; |
87 | io.send(RawMsg::Response(resp)); | 86 | io.send(RawMsg::Response(resp)); |
88 | Ok(()) | 87 | Ok(()) |
89 | })?; | 88 | })?; |
90 | if let Some(req) = req { | 89 | if let Some(req) = req { |
91 | bail!("expected initialize request, got {:?}", req) | 90 | bail!("expected initialize request, got {:?}", req) |
92 | } | 91 | } |
93 | match io.recv()? { | 92 | match io.recv()? { |
94 | RawMsg::Notification(n) => { | 93 | RawMsg::Notification(n) => { |
95 | if n.method != "initialized" { | 94 | if n.method != "initialized" { |
96 | bail!("expected initialized notification"); | 95 | bail!("expected initialized notification"); |
97 | } | ||
98 | } | 96 | } |
99 | _ => bail!("expected initialized notification"), | ||
100 | } | 97 | } |
101 | break; | 98 | _ => bail!("expected initialized notification"), |
102 | } | 99 | } |
103 | } | 100 | } |
104 | } | 101 | } |