Lint of examples/ with ale for vim?

I'm currently compiling a list of rust examples useful for my use cases (beginner here). I saw that one can create examples in the examples/ directory and run them with cargo run --example the_example.

What I'm missing though with this approach is the linting of the files. I'm using neovim and ale for linting. For library or main code, it is awesome. For files in the examples/ directory though the linting is not done. Advices?

Hi @mattpiz it looks like the limitation of ale cargo linter which can be configured only to test the lib and target source code but does not allow passing

cargo check --examples --tests

which would report errors in examples and tests. I'd submit a bug report to their repo It is quite simple to add actually, you can try with a fork I've made few seconds ago.

Plugin 'budziq/ale'
let g:ale_rust_cargo_use_check = 1
let g:ale_rust_cargo_check_tests = 1
let g:ale_rust_cargo_check_examples = 1
1 Like

Thanks! that's awesome! I'll open an issue with link to this post and budziq/ale commit to ask if it is possible have it integrated

I've already made a PR for their repo so you might link to it in the issue just as well. Glad to be of help :slight_smile: