I'm on the latest version of the rustic package and have things setup to run rustfmt on save. I'm passing the +nightly flag. Unfortunately, none of the settings in my repository's rustfmt.toml file are ever taken into account when saving through rustic. The package is formatting my code though with rustfmt, it just doesn't use my settings. Here's my configuration:
(use-package rustic
:hook (rustic-mode . yas-minor-mode)
:bind
(:map
rustic-mode-map
("M-j" . lsp-ui-imenu)
("M-?" . lsp-find-references)
("C-c C-c l" . flycheck-list-errors)
("C-c C-c a" . lsp-execute-code-action)
("C-c C-c r" . lsp-rename)
("C-c C-c q" . lsp-workspace-restart)
("C-c C-c Q" . lsp-workspace-shutdown)
("C-c C-c s" . lsp-rust-analyzer-status))
:init
(progn
;; Use nightly rust for formatting.
(setq rustic-rustfmt-args "+nightly")
;; Use rustfmt on save.
(setq rustic-format-on-save t))
:config
(progn
;; Use electric pair mode.
(electric-pair-mode 1)
;; This fixes a bug, see below.
(add-hook 'rustic-mode-hook 'rk/rustic-mode-hook)))
(defun rk/rustic-mode-hook ()
;; Do this so that running C-c C-c C-r works without having to
;; confirm, but don't try to save rust buffers that are not file
;; visiting. Once https://github.com/brotzeit/rustic/issues/253
;; has been resolved this should no longer be necessary.
(when buffer-file-name
(setq-local buffer-save-without-query t)))
This shouldn't matter as I use it everywhere, but here's my rustfmt.toml file as well:
version = "Two"
edition = "2021"
newline_style = "Unix"
trailing_comma = "Never"
merge_derives = false
struct_field_align_threshold = 32
chain_width = 36
imports_granularity = "Crate"
match_block_trailing_comma = true
Sadly this has rendered the package unusable for me at present, perhaps this is a bug?
I'm on the latest version of the
rusticpackage and have things setup to runrustfmton save. I'm passing the+nightlyflag. Unfortunately, none of the settings in my repository'srustfmt.tomlfile are ever taken into account when saving throughrustic. The package is formatting my code though withrustfmt, it just doesn't use my settings. Here's my configuration:This shouldn't matter as I use it everywhere, but here's my
rustfmt.tomlfile as well:Sadly this has rendered the package unusable for me at present, perhaps this is a bug?