From a1054e5ae2b920e693cbde5c2a6ca4de5b06cc6f Mon Sep 17 00:00:00 2001 From: Fletcher Nichol Date: Mon, 30 May 2016 20:46:05 -0600 Subject: [PATCH] Support rustfmt 0.5.0 exit codes. This change updates the acceptable exit codes from `rustfmt` when deciding whether or not to write back the file or display the errors location list. As of rust-lang-nursery/rustfmt#923, `rustfmt` exits with either a 0, 1, 2, or 3 depending on what happened. Prior to this upstream change, `rustfmt` would exit 0 when issues that cannot be automatically resolved would occur. Now, the same errors (such as "line exceeded maximum length") result in an exit of 3 (see the [README](line exceeded maximum length) for more details). This change will treat an exit of 3 as "okay" for writing back as `rustfmt` didn't fail (it just couldn't auto-format a nicer solution). Closes #68 Closes #75 References rust-lang-nursery/rustfmt#923 --- autoload/rustfmt.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/rustfmt.vim b/autoload/rustfmt.vim index fbbac65d..96a9a9cc 100644 --- a/autoload/rustfmt.vim +++ b/autoload/rustfmt.vim @@ -29,7 +29,7 @@ function! rustfmt#Format() let out = systemlist(command . g:rustfmt_options . " " . shellescape(l:tmpname)) - if v:shell_error == 0 + if v:shell_error == 0 || v:shell_error == 3 " remove undo point caused via BufWritePre try | silent undojoin | catch | endtry