mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
remove useless loop
This commit is contained in:
parent
b518fd0ef9
commit
535bd7ccf7
1 changed files with 21 additions and 24 deletions
|
@ -72,33 +72,30 @@ fn main_inner() -> Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn initialize(io: &mut Io) -> Result<()> {
|
fn initialize(io: &mut Io) -> Result<()> {
|
||||||
loop {
|
match io.recv()? {
|
||||||
match io.recv()? {
|
RawMsg::Notification(n) =>
|
||||||
RawMsg::Notification(n) =>
|
bail!("expected initialize request, got {:?}", n),
|
||||||
bail!("expected initialize request, got {:?}", n),
|
RawMsg::Response(res) =>
|
||||||
RawMsg::Response(res) =>
|
bail!("expected initialize request, got {:?}", res),
|
||||||
bail!("expected initialize request, got {:?}", res),
|
|
||||||
|
|
||||||
RawMsg::Request(req) => {
|
RawMsg::Request(req) => {
|
||||||
let mut req = Some(req);
|
let mut req = Some(req);
|
||||||
dispatch::handle_request::<req::Initialize, _>(&mut req, |_params, resp| {
|
dispatch::handle_request::<req::Initialize, _>(&mut req, |_params, resp| {
|
||||||
let res = req::InitializeResult { capabilities: caps::SERVER_CAPABILITIES };
|
let res = req::InitializeResult { capabilities: caps::SERVER_CAPABILITIES };
|
||||||
let resp = resp.into_response(Ok(res))?;
|
let resp = resp.into_response(Ok(res))?;
|
||||||
io.send(RawMsg::Response(resp));
|
io.send(RawMsg::Response(resp));
|
||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
if let Some(req) = req {
|
if let Some(req) = req {
|
||||||
bail!("expected initialize request, got {:?}", req)
|
bail!("expected initialize request, got {:?}", req)
|
||||||
}
|
}
|
||||||
match io.recv()? {
|
match io.recv()? {
|
||||||
RawMsg::Notification(n) => {
|
RawMsg::Notification(n) => {
|
||||||
if n.method != "initialized" {
|
if n.method != "initialized" {
|
||||||
bail!("expected initialized notification");
|
bail!("expected initialized notification");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => bail!("expected initialized notification"),
|
|
||||||
}
|
}
|
||||||
break;
|
_ => bail!("expected initialized notification"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue