blob: 7f821d2c1780db773934e0896c296a66a97bda11 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
" Description: rustc invoked by cargo for rust files
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
if ale#util#FindNearestFile(a:bufnr, 'Cargo.toml') !=# ''
return 'cargo'
else
" if there is no Cargo.toml file, we don't use cargo even if it exists,
" so we return '', because executable('') apparently always fails
return ''
endif
endfunction
call ale#linter#Define('rust', {
\ 'name': 'cargo',
\ 'executable_callback': 'ale_linters#rust#cargo#GetCargoExecutable',
\ 'command': 'cargo build --message-format=json -q',
\ 'callback': 'ale#handlers#rust#HandleRustErrors',
\ 'output_stream': 'stdout',
\})
|