Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ that caused Neoformat to be invoked.
[`rubocop`](https://github.com/bbatsov/rubocop)
- Rust
- [`rustfmt`](https://github.com/rust-lang-nursery/rustfmt)
```vim
let g:rustfmt_edition_opt="2021"
```
- Sass
- [`sass-convert`](http://sass-lang.com/documentation/#executables),
[`stylelint`](https://stylelint.io/),
Expand Down
4 changes: 4 additions & 0 deletions autoload/neoformat/formatters/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ function! neoformat#formatters#rust#enabled() abort
endfunction

function! neoformat#formatters#rust#rustfmt() abort
let opts = get(g:, 'rustfmt_edition_opt', '')
if opts != ''
let opts = '--edition ' . opts

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this require an endif?

@cppcoffee cppcoffee Mar 15, 2022

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right, the endif has been added.

return {
\ 'exe': 'rustfmt',
\ 'args': [opts],
\ 'stdin': 1,
\ }
endfunction