diff options
author | Linda_pp <rhysd@users.noreply.github.com> | 2018-10-22 17:21:48 +0900 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2018-10-22 09:21:48 +0100 |
commit | f57ad883f2ddb0613ffeffa4529269a6bcaf913a (patch) | |
tree | 84eff25feebe9f74f1a873a00591f7675b321778 /ale_linters/rust/cargo.vim | |
parent | 3bda13298860da5a88e114d812937e727d4e8f56 (diff) | |
download | ale-f57ad883f2ddb0613ffeffa4529269a6bcaf913a.zip |
Add support for `cargo clippy` (#2001)
* Add support for `cargo clippy`
* Add tests for cargo-clippy support
* Add an example to doc for how to configure ale_rust_cargo_use_clippy
Diffstat (limited to 'ale_linters/rust/cargo.vim')
-rw-r--r-- | ale_linters/rust/cargo.vim | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ale_linters/rust/cargo.vim b/ale_linters/rust/cargo.vim index 5aefe72c..cf6187f8 100644 --- a/ale_linters/rust/cargo.vim +++ b/ale_linters/rust/cargo.vim @@ -9,6 +9,8 @@ call ale#Set('rust_cargo_check_tests', 0) call ale#Set('rust_cargo_avoid_whole_workspace', 1) call ale#Set('rust_cargo_default_feature_behavior', 'default') call ale#Set('rust_cargo_include_features', '') +call ale#Set('rust_cargo_use_clippy', 0) +call ale#Set('rust_cargo_clippy_options', '') function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# '' @@ -70,14 +72,23 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort let l:default_feature = '' endif + let l:subcommand = l:use_check ? 'check' : 'build' + let l:clippy_options = '' + + if ale#Var(a:buffer, 'rust_cargo_use_clippy') + let l:subcommand = 'clippy' + let l:clippy_options = ' ' . ale#Var(a:buffer, 'rust_cargo_clippy_options') + endif + return l:nearest_cargo_prefix . 'cargo ' - \ . (l:use_check ? 'check' : 'build') + \ . l:subcommand \ . (l:use_all_targets ? ' --all-targets' : '') \ . (l:use_examples ? ' --examples' : '') \ . (l:use_tests ? ' --tests' : '') \ . ' --frozen --message-format=json -q' \ . l:default_feature \ . l:include_features + \ . l:clippy_options endfunction call ale#linter#Define('rust', { |