diff options
author | w0rp <devw0rp@gmail.com> | 2018-08-02 23:44:12 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-08-02 23:44:12 +0100 |
commit | 217284360d35711b751859ed27a7a3c3da300e85 (patch) | |
tree | 4b26a84b397e3ac15a8b13a572b1f9a50312dbab /ale_linters/rust | |
parent | 9ef266d050d698c3ed3be3456ce6a5da5755d5ef (diff) | |
download | ale-217284360d35711b751859ed27a7a3c3da300e85.zip |
Simplify the code for most linters and tests with closures
Diffstat (limited to 'ale_linters/rust')
-rw-r--r-- | ale_linters/rust/rls.vim | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/ale_linters/rust/rls.vim b/ale_linters/rust/rls.vim index cd13291d..60dd3667 100644 --- a/ale_linters/rust/rls.vim +++ b/ale_linters/rust/rls.vim @@ -4,19 +4,10 @@ call ale#Set('rust_rls_executable', 'rls') call ale#Set('rust_rls_toolchain', 'nightly') -function! ale_linters#rust#rls#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'rust_rls_executable') -endfunction - function! ale_linters#rust#rls#GetCommand(buffer) abort - let l:executable = ale_linters#rust#rls#GetExecutable(a:buffer) let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain') - if empty(l:toolchain) - return ale#Escape(l:executable) - else - return ale#Escape(l:executable) . ' +' . ale#Escape(l:toolchain) - endif + return '%e' . (!empty(l:toolchain) ? ' +' . ale#Escape(l:toolchain) : '') endfunction function! ale_linters#rust#rls#GetProjectRoot(buffer) abort @@ -28,7 +19,7 @@ endfunction call ale#linter#Define('rust', { \ 'name': 'rls', \ 'lsp': 'stdio', -\ 'executable_callback': 'ale_linters#rust#rls#GetExecutable', +\ 'executable_callback': ale#VarFunc('rust_rls_executable'), \ 'command_callback': 'ale_linters#rust#rls#GetCommand', \ 'project_root_callback': 'ale_linters#rust#rls#GetProjectRoot', \}) |