From b0eaddadc9b4b99f8f0163a5b55ab4dc0499d238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindstr=C3=B6m?= Date: Wed, 27 Dec 2017 23:03:46 +0700 Subject: [PATCH] Don't use temporary file for rustfmt fixer rustfmt normally acts on a file in place, and applies configuration from rustfmt.toml files according to the path of the file. Using a temporary file for rustfmt breaks this functionality, so removing the '%t' from the rustfmt command. --- autoload/ale/fixers/rustfmt.vim | 4 +--- test/fixers/test_rustfmt_fixer_callback.vader | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/autoload/ale/fixers/rustfmt.vim b/autoload/ale/fixers/rustfmt.vim index fb5ac61..38882fb 100644 --- a/autoload/ale/fixers/rustfmt.vim +++ b/autoload/ale/fixers/rustfmt.vim @@ -10,8 +10,6 @@ function! ale#fixers#rustfmt#Fix(buffer) abort return { \ 'command': ale#Escape(l:executable) - \ . (empty(l:options) ? '' : ' ' . l:options) - \ . ' %t', - \ 'read_temporary_file': 1, + \ . (empty(l:options) ? '' : ' ' . l:options), \} endfunction diff --git a/test/fixers/test_rustfmt_fixer_callback.vader b/test/fixers/test_rustfmt_fixer_callback.vader index 36dd58a..95c78de 100644 --- a/test/fixers/test_rustfmt_fixer_callback.vader +++ b/test/fixers/test_rustfmt_fixer_callback.vader @@ -18,9 +18,7 @@ Execute(The rustfmt callback should return the correct default values): AssertEqual \ { - \ 'read_temporary_file': 1, - \ 'command': ale#Escape('xxxinvalid') - \ . ' %t', + \ 'command': ale#Escape('xxxinvalid'), \ }, \ ale#fixers#rustfmt#Fix(bufnr('')) @@ -30,9 +28,7 @@ Execute(The rustfmt callback should include custom rustfmt options): AssertEqual \ { - \ 'read_temporary_file': 1, \ 'command': ale#Escape('xxxinvalid') - \ . ' ' . g:ale_rust_rustfmt_options - \ . ' %t', + \ . ' ' . g:ale_rust_rustfmt_options, \ }, \ ale#fixers#rustfmt#Fix(bufnr(''))