From 235576d168898807c7a4cd3129efb9d5b926d705 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 19 Sep 2017 05:07:24 +0200 Subject: [PATCH] lang/rust: minor refactor --- modules/lang/rust/config.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/lang/rust/config.el b/modules/lang/rust/config.el index 6dfa517eb..5b939b8f2 100644 --- a/modules/lang/rust/config.el +++ b/modules/lang/rust/config.el @@ -1,12 +1,15 @@ ;;; lang/rust/config.el -*- lexical-binding: t; -*- -(defvar +rust-ext-dir (concat doom-etc-dir "rust/") - "TODO") +(defvar +rust-src-dir (concat doom-etc-dir "rust/") + "The path to Rust source library. Required by racer.") + + +;; +;; Plugins +;; (def-package! rust-mode :mode "\\.rs$" - :init - (add-hook 'rust-mode-hook #'flycheck-mode) :config (set! :build 'run-cargo '(rust-mode toml-mode) #'+rust/run-cargo :when #'+rust-cargo-project-p)) @@ -18,8 +21,8 @@ :init (add-hook! 'rust-mode-hook #'(racer-mode eldoc-mode flycheck-rust-setup)) :config - (setq racer-cmd (expand-file-name "racer/target/release/racer" +rust-ext-dir) - racer-rust-src-path (expand-file-name "rust/src/" +rust-ext-dir)) + (setq racer-cmd (expand-file-name "racer/target/release/racer" +rust-src-dir) + racer-rust-src-path (expand-file-name "rust/src/" +rust-src-dir)) (unless (file-exists-p racer-cmd) (warn "rust-mode: racer binary can't be found; auto-completion is disabled")) @@ -36,5 +39,6 @@ (def-package! flycheck-rust :when (featurep! :feature syntax-checker) - :after rust-mode) + :after rust-mode + :config (add-hook 'rust-mode-hook #'flycheck-mode))