diff options
author | Aleksander Vognild Burkow <[email protected]> | 2018-12-29 23:21:15 +0000 |
---|---|---|
committer | Aleksander Vognild Burkow <[email protected]> | 2018-12-29 23:21:15 +0000 |
commit | 0cb270e75d9501dff9ac6633354ae12d9c0f4260 (patch) | |
tree | 09ad38ec9b66d6e8d36a392670eb21dd03d7d5f9 /crates/ra_lsp_server/src | |
parent | ed47c93afe7f9dd2c27956905e7fb9fcf9d5baf2 (diff) |
Simplify failure bail code
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index ecfa42206..a2c12a4c1 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -625,10 +625,11 @@ pub fn handle_formatting( | |||
625 | let output = rustfmt.wait_with_output()?; | 625 | let output = rustfmt.wait_with_output()?; |
626 | let captured_stdout = String::from_utf8(output.stdout)?; | 626 | let captured_stdout = String::from_utf8(output.stdout)?; |
627 | if !output.status.success() { | 627 | if !output.status.success() { |
628 | return Err(failure::err_msg(format!( | 628 | failure::bail!( |
629 | "rustfmt exited with error code {}: {}.", | 629 | "rustfmt exited with error code {}: {}.", |
630 | output.status, captured_stdout | 630 | output.status, |
631 | ))); | 631 | captured_stdout, |
632 | ); | ||
632 | } | 633 | } |
633 | 634 | ||
634 | Ok(Some(vec![TextEdit { | 635 | Ok(Some(vec![TextEdit { |