diff options
author | w0rp <devw0rp@gmail.com> | 2017-12-19 18:10:29 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-12-19 18:10:29 +0000 |
commit | 73f61514c9039e7e863da3544f251d3f8d7d1956 (patch) | |
tree | 56a8b2160ef4d8b3e82a5349332af5bf6c95caa0 /ale_linters/rust | |
parent | cc8e5502c8fd9d0d2ba405214e05f90b4152e2b2 (diff) | |
download | ale-73f61514c9039e7e863da3544f251d3f8d7d1956.zip |
Fix #1031 - Make the rust flags configurable
Diffstat (limited to 'ale_linters/rust')
-rw-r--r-- | ale_linters/rust/rustc.vim | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ale_linters/rust/rustc.vim b/ale_linters/rust/rustc.vim index e792faa7..3cd401b3 100644 --- a/ale_linters/rust/rustc.vim +++ b/ale_linters/rust/rustc.vim @@ -1,21 +1,27 @@ " Author: Daniel Schemala <istjanichtzufassen@gmail.com> " Description: rustc for rust files -function! ale_linters#rust#rustc#RustcCommand(buffer_number) abort +call ale#Set('rust_rustc_options', '-Z no-trans') + +function! ale_linters#rust#rustc#RustcCommand(buffer) abort " Try to guess the library search path. If the project is managed by cargo, " it's usually <project root>/target/debug/deps/ or " <project root>/target/release/deps/ - let l:cargo_file = ale#path#FindNearestFile(a:buffer_number, 'Cargo.toml') + let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') if l:cargo_file isnot# '' - let l:project_root = fnamemodify(l:cargo_file, ':h') - let l:dependencies = '-L ' . l:project_root . '/target/debug/deps -L ' . - \ l:project_root . '/target/release/deps' + let l:root = fnamemodify(l:cargo_file, ':h') + let l:dependencies = ' -L ' . ale#Escape(ale#path#GetAbsPath(l:root, 'target/debug/deps')) + \ . ' -L ' . ale#Escape(ale#path#GetAbsPath(l:root, 'target/release/deps')) else let l:dependencies = '' endif - return 'rustc --error-format=json -Z no-trans ' . l:dependencies . ' -' + let l:options = ale#Var(a:buffer, 'rust_rustc_options') + + return 'rustc --error-format=json' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . l:dependencies . ' -' endfunction call ale#linter#Define('rust', { |