diff --git a/ale_linters/rust/cargo.vim b/ale_linters/rust/cargo.vim index ae26fab4..a0e123a4 100644 --- a/ale_linters/rust/cargo.vim +++ b/ale_linters/rust/cargo.vim @@ -2,7 +2,7 @@ " Description: rustc invoked by cargo for rust files call ale#Set('rust_cargo_use_check', 1) -call ale#Set('rust_cargo_check_all_targets', 1) +call ale#Set('rust_cargo_check_all_targets', 0) function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# '' diff --git a/doc/ale-rust.txt b/doc/ale-rust.txt index a32c90b0..64d5293c 100644 --- a/doc/ale-rust.txt +++ b/doc/ale-rust.txt @@ -53,7 +53,7 @@ g:ale_rust_cargo_use_check *g:ale_rust_cargo_use_check* g:ale_rust_cargo_check_all_targets *g:ale_rust_cargo_check_all_targets* *b:ale_rust_cargo_check_all_targets* Type: |Number| - Default: `1` + Default: `0` When set to `1`, ALE will set the `--all-targets` option when `cargo check` is used. See |g:ale_rust_cargo_use_check|, diff --git a/test/command_callback/test_cargo_command_callbacks.vader b/test/command_callback/test_cargo_command_callbacks.vader index 10535516..65ea5a80 100644 --- a/test/command_callback/test_cargo_command_callbacks.vader +++ b/test/command_callback/test_cargo_command_callbacks.vader @@ -85,23 +85,7 @@ Execute(`cargo build` should be used when g:ale_rust_cargo_use_check is set to 0 AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr('')) -Execute(`cargo check --all-targets` should be used when the version is new enough): - AssertEqual - \ 'cargo check --all-targets' . g:suffix, - \ ale_linters#rust#cargo#GetCommand(bufnr(''), [ - \ 'cargo 0.22.0 (3423351a5 2017-10-06)', - \ ]) - - " We should cache the version check - AssertEqual - \ 'cargo check --all-targets' . g:suffix, - \ ale_linters#rust#cargo#GetCommand(bufnr(''), []) - - AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr('')) - -Execute(--all-targets should not be used when g:ale_rust_cargo_check_all_targets is set to 0): - let g:ale_rust_cargo_check_all_targets = 0 - +Execute(`cargo check` should be used when the version is new enough): AssertEqual \ 'cargo check' . g:suffix, \ ale_linters#rust#cargo#GetCommand(bufnr(''), [ @@ -114,3 +98,19 @@ Execute(--all-targets should not be used when g:ale_rust_cargo_check_all_targets \ ale_linters#rust#cargo#GetCommand(bufnr(''), []) AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr('')) + +Execute(--all-targets should be used when g:ale_rust_cargo_check_all_targets is set to 1): + let g:ale_rust_cargo_check_all_targets = 1 + + AssertEqual + \ 'cargo check --all-targets' . g:suffix, + \ ale_linters#rust#cargo#GetCommand(bufnr(''), [ + \ 'cargo 0.22.0 (3423351a5 2017-10-06)', + \ ]) + + " We should cache the version check + AssertEqual + \ 'cargo check --all-targets' . g:suffix, + \ ale_linters#rust#cargo#GetCommand(bufnr(''), []) + + AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr(''))