From 217284360d35711b751859ed27a7a3c3da300e85 Mon Sep 17 00:00:00 2001 From: w0rp Date: Thu, 2 Aug 2018 23:44:12 +0100 Subject: Simplify the code for most linters and tests with closures --- ale_linters/rust/rls.vim | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'ale_linters/rust') 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', \}) -- cgit v1.2.3