diff --git a/contrib/!lang/rust/packages.el b/contrib/!lang/rust/packages.el index f4b870454..8a4a7f04a 100644 --- a/contrib/!lang/rust/packages.el +++ b/contrib/!lang/rust/packages.el @@ -12,6 +12,7 @@ (defvar rust-packages '( + flycheck flycheck-rust rust-mode toml-mode @@ -19,11 +20,16 @@ "List of all packages to install and/or initialize. Built-in packages which require an initialization must be listed explicitly in the list.") -(defun rust/init-flycheck-rust () - (use-package flycheck-rust - :defer t - :init - (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))) +(defun rust/post-init-flycheck () + (add-hook 'rust-mode-hook 'flycheck-mode)) + +(when (configuration-layer/layer-usedp 'syntax-checking) + (defun rust/init-flycheck-rust () + (use-package flycheck-rust + :if (configuration-layer/package-usedp 'flycheck) + :defer t + :init + (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)))) (defun rust/init-rust-mode () (use-package rust-mode