Skip to content

Commit

Permalink
Work around rust-lang/rust#55937
Browse files Browse the repository at this point in the history
This exchanges a compilation error for a warning-but-future-error
but at least it compiles now and I'm not exactly sure how to fix it
without cloning those `METHOD` constants on every match (which is less
than ideal, to say the least).
  • Loading branch information
Xanewok committed Jan 2, 2019
1 parent 82ecfdc commit 085e926
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl<O: Output> LsService<O> {
}
}

fn dispatch_message(&mut self, msg: &RawMessage) -> Result<(), jsonrpc::Error> {
fn dispatch_message(&mut self, msg: RawMessage) -> Result<(), jsonrpc::Error> {
macro_rules! match_action {
(
$method: expr;
Expand Down Expand Up @@ -334,9 +334,12 @@ impl<O: Output> LsService<O> {
}
}

if let Err(e) = self.dispatch_message(&raw_message) {
// Workaround https://github.com/rust-lang/rust/pull/55937 by moving
// raw_message instead of borrowing.
let id = raw_message.id.clone();
if let Err(e) = self.dispatch_message(raw_message) {
error!("dispatch error: {:?}, message: `{}`", e, msg_string);
self.output.failure(raw_message.id, e);
self.output.failure(id, e);
return ServerStateChange::Break { exit_code: 101 };
}

Expand Down

0 comments on commit 085e926

Please sign in to comment.