diff options
author | w0rp <w0rp@users.noreply.github.com> | 2017-02-06 09:34:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-06 09:34:27 +0000 |
commit | ccf78c40b10b8ea2adda8fd308e524890216e1b5 (patch) | |
tree | f2f4932d8b98422784776117157b7ee3bcc26501 /ale_linters | |
parent | 9d855904211f60f7d93765ce24b736d364858261 (diff) | |
parent | 0143eb6a53fdf77e6d11b5d714501db2667b3ee2 (diff) | |
download | ale-ccf78c40b10b8ea2adda8fd308e524890216e1b5.zip |
Merge pull request #305 from notkild/master
Fix rust linting with cargo when multiple targets are present
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/rust/cargo.vim | 4 | ||||
-rw-r--r-- | ale_linters/rust/rustc.vim | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/ale_linters/rust/cargo.vim b/ale_linters/rust/cargo.vim index 738821d7..8c782656 100644 --- a/ale_linters/rust/cargo.vim +++ b/ale_linters/rust/cargo.vim @@ -15,7 +15,7 @@ endfunction call ale#linter#Define('rust', { \ 'name': 'cargo', \ 'executable_callback': 'ale_linters#rust#cargo#GetCargoExecutable', -\ 'command': 'cargo rustc -- --error-format=json -Z no-trans', +\ 'command': 'cargo build --message-format=json -q', \ 'callback': 'ale_linters#rust#rustc#HandleRustcErrors', -\ 'output_stream': 'stderr', +\ 'output_stream': 'stdout', \}) diff --git a/ale_linters/rust/rustc.vim b/ale_linters/rust/rustc.vim index 3eeede66..e31b895c 100644 --- a/ale_linters/rust/rustc.vim +++ b/ale_linters/rust/rustc.vim @@ -17,12 +17,20 @@ function! ale_linters#rust#rustc#HandleRustcErrors(buffer_number, errorlines) ab endif let l:error = json_decode(l:errorline) + if !has_key(l:error, 'code') && !has_key(l:error, 'message') + continue + endif + + if has_key(l:error, 'message') + let l:error = l:error.message + endif if !empty(l:error.code) && index(g:ale_rust_ignore_error_codes, l:error.code.code) > -1 continue endif for l:span in l:error.spans + let l:span.file_name = fnamemodify(l:span.file_name, ':t') if l:span.is_primary && \ (l:span.file_name ==# l:file_name || l:span.file_name ==# '<anon>') call add(l:output, { |