diff options
Diffstat (limited to 'ale_linters/rust')
-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', { |