From 0cb270e75d9501dff9ac6633354ae12d9c0f4260 Mon Sep 17 00:00:00 2001 From: Aleksander Vognild Burkow Date: Sun, 30 Dec 2018 00:21:15 +0100 Subject: Simplify failure bail code --- crates/ra_lsp_server/src/main_loop/handlers.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/ra_lsp_server/src') 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( let output = rustfmt.wait_with_output()?; let captured_stdout = String::from_utf8(output.stdout)?; if !output.status.success() { - return Err(failure::err_msg(format!( + failure::bail!( "rustfmt exited with error code {}: {}.", - output.status, captured_stdout - ))); + output.status, + captured_stdout, + ); } Ok(Some(vec![TextEdit { -- cgit v1.2.3