Closed adrena-orex closed 1 year ago
Requires to use +nightly
because imports_granularity
and group_imports
rules are not Stable
and requires nightly mode.
If ran without +nightly
:
orex> cargo fmt
Warning: can't set `imports_granularity = One`, unstable features are only available in nightly channel.
Warning: can't set `group_imports = One`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = One`, unstable features are only available in nightly channel.
Warning: can't set `group_imports = One`, unstable features are only available in nightly channel.
Ngl grouping imports has been a pain, need Might want to add this as pre-commit-hook? (not adding clippy there cause it will download deps and compile project at each commit)
#!/bin/bash
diff=$(cargo +nightly fmt -- --check)
result=$?
if [[ ${result} -ne 0 ]] ; then
cat <<\EOF
There are some code style issues, run `cargo fmt` first.
EOF
exit 1
fi
exit 0
it doesn't seem to be working with Vs Code out of the box: https://github.com/rust-lang/rust-analyzer/issues/6973
I.e. rustfmt.toml is ignored, providing all args to rust-analyzer.rustfmt.overrideCommand
might be the only viable solution, which is not the end of the world, but still. At least README.md will need to be updated. Could you check if you can make it work?
It's possible to add +nightly
as extra args for rustanalyser.
"rust-analyzer.rustfmt.extraArgs": [
"+nightly"
],
Why it doesn't work right away is because toolchain is configured as 1.66.0
and that is what is used by default with rustfmt
.
@askibin I have updated the README.md and added .vscode/settings.json
to automatically apply the +nightly
.
Not sure if we should include the .vscode
there or if users should manually configure it in theirs vscode at install. I let you tell me, I'm ok both ways.
Added pre-commit hook. Needs to execute the command git config core.hooksPath .githooks
. Have updated README.md.
@askibin I have updated the README.md and added
.vscode/settings.json
to automatically apply the+nightly
.Not sure if we should include the
.vscode
there or if users should manually configure it in theirs vscode at install. I let you tell me, I'm ok both ways.
I think the .vscode should be added to have a self contained working repo?
could you resolve conflicts please
could you resolve conflicts please
Done!
Setup new
rustfmt.toml
file to specify custom rules:See:
To run:
What changes: