diff options
author | Michał Budzyński <budziq@gmail.com> | 2018-06-04 11:08:49 +0200 |
---|---|---|
committer | Michał Budzyński <budziq@gmail.com> | 2018-06-04 11:08:49 +0200 |
commit | e2722071147a5a7feaadf7d574bc64f628402cdc (patch) | |
tree | 4a20be56fbc82248a5bcd2a96daa9ece4237f5fb /ale_linters/rust | |
parent | 4ec661b305bb168891624eb89466c1a2558fe63b (diff) | |
download | ale-e2722071147a5a7feaadf7d574bc64f628402cdc.zip |
Allow linting rust tests and examples with cargo
Diffstat (limited to 'ale_linters/rust')
-rw-r--r-- | ale_linters/rust/cargo.vim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ale_linters/rust/cargo.vim b/ale_linters/rust/cargo.vim index 09f41bbb..ef0c3bd1 100644 --- a/ale_linters/rust/cargo.vim +++ b/ale_linters/rust/cargo.vim @@ -4,6 +4,8 @@ call ale#Set('rust_cargo_use_check', 1) call ale#Set('rust_cargo_check_all_targets', 0) +call ale#Set('rust_cargo_check_examples', 0) +call ale#Set('rust_cargo_check_tests', 0) call ale#Set('rust_cargo_default_feature_behavior', 'default') call ale#Set('rust_cargo_include_features', '') @@ -31,6 +33,12 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort let l:use_all_targets = l:use_check \ && ale#Var(a:buffer, 'rust_cargo_check_all_targets') \ && ale#semver#GTE(l:version, [0, 22, 0]) + let l:use_examples = l:use_check + \ && ale#Var(a:buffer, 'rust_cargo_check_examples') + \ && ale#semver#GTE(l:version, [0, 22, 0]) + let l:use_tests = l:use_check + \ && ale#Var(a:buffer, 'rust_cargo_check_tests') + \ && ale#semver#GTE(l:version, [0, 22, 0]) let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features') if !empty(l:include_features) @@ -50,6 +58,8 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort return 'cargo ' \ . (l:use_check ? 'check' : 'build') \ . (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 |