Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1220 from Xanewok/ub-or-not-ub
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok authored Jan 2, 2019
2 parents 82ecfdc + 085e926 commit cdc2464
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 cdc2464

Please sign in to comment.