Bump :lang rust

brotzeit/rustic@d97ec86 -> brotzeit/rustic@ed68fd3

Includes minor refactors
This commit is contained in:
Henrik Lissner 2021-05-02 17:26:01 -04:00
parent 21b8af1ce1
commit a7df1f76a4
3 changed files with 24 additions and 22 deletions

View File

@ -19,6 +19,7 @@
;;
;;; Custom Cargo commands
(autoload 'rustic-run-cargo-command "rustic-cargo")
;;;###autoload
(defun +rust/cargo-audit ()
"Run 'cargo audit' for the current project."

View File

@ -9,29 +9,39 @@
(use-package! rustic
:mode ("\\.rs$" . rustic-mode)
:commands rustic-run-cargo-command rustic-cargo-outdated
:init
(after! org-src
(defalias 'org-babel-execute:rust #'org-babel-execute:rustic)
(add-to-list 'org-src-lang-modes '("rust" . rustic)))
(add-to-list 'org-src-lang-modes '("rust" . rustic))
(add-to-list 'org-babel-tangle-lang-exts '("rustic" . "rs")))
:config
(setq rustic-indent-method-chain t)
(set-docsets! 'rustic-mode "Rust")
(set-popup-rule! "^\\*rustic-compilation" :vslot -1)
(setq rustic-indent-method-chain t
;; use :editor format instead
;; Leave automatic reformatting to the :editor format module.
(set-formatter! 'rustfmt #'rustic-format-buffer :modes '(rustic-mode))
(setq rustic-babel-format-src-block (featurep! :editor format +onsave)
rustic-format-trigger nil)
(if (featurep! +lsp)
(add-hook 'rustic-mode-local-vars-hook #'lsp!)
(setq rustic-lsp-server nil)
(after! rustic-flycheck
(add-to-list 'flycheck-checkers 'rustic-clippy)))
;; HACK `rustic-flycheck' adds all these hooks in disruptive places. Instead,
;; leave it to our :checkers syntax module to do all the set up properly.
(remove-hook 'rustic-mode-hook #'flycheck-mode)
(remove-hook 'rustic-mode-hook #'flymake-mode-off)
(unless (featurep! +lsp)
(add-to-list 'flycheck-checkers 'rustic-clippy))
;; HACK `rustic-lsp' sets up lsp-mode/eglot too early. We move it to
;; `rustic-mode-local-vars-hook' so file/dir local variables can be used
;; to reconfigure them.
(when (featurep! +lsp)
(if (featurep! :tools lsp +eglot)
(setq rustic-lsp-client 'eglot)
(setq rustic-lsp-client 'lsp-mode)))
(remove-hook 'rustic-mode-hook #'rustic-setup-lsp)
(add-hook 'rustic-mode-local-vars-hook #'rustic-setup-lsp)
(setq rustic-lsp-client
(if (featurep! :tools lsp +eglot)
'eglot
'lsp-mode)))
(map! :map rustic-mode-map
:localleader
@ -50,15 +60,6 @@
:desc "all" "a" #'rustic-cargo-test
:desc "current test" "t" #'rustic-cargo-current-test))
;; HACK Fixes #2541: RLS doesn't appear to support documentSymbol, but
;; lsp-rust thinks it does, and so yields imenu population to the server.
;; The result is an empty imenu list. Until RLS supports documentSymbol,
;; we disable `lsp-enable-imenu' is rust+RLS buffers.
(defadvice! +rust--disable-imenu-for-lsp-mode-a (&rest _)
:before #'rustic-lsp-mode-setup
(when (eq rustic-lsp-server 'rls)
(setq-local lsp-enable-imenu nil)))
;; If lsp/elgot isn't available, it attempts to install lsp-mode via
;; package.el. Doom manages its own dependencies through straight so disable
;; this behavior to avoid package-not-initialized errors.

View File

@ -1,6 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; lang/rust/packages.el
(package! rustic :pin "d97ec8623c4c7e7ad3bb32e3d3773ba29a34bb0d")
(package! rustic :pin "ed68fd3bb410869e1a4ce3943b5913ea88d9b509")
(unless (featurep! +lsp)
(package! racer :pin "1e63e98626737ea9b662d4a9b1ffd6842b1c648c"))