lang/rust: refactor racer config

A lot of the previous logic is redundant and already done by the racer
package.
This commit is contained in:
Henrik Lissner 2018-02-18 03:13:42 -05:00
parent 0408464489
commit 02ad689890
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -1,9 +1,5 @@
;;; lang/rust/config.el -*- lexical-binding: t; -*-
(defvar +rust-src-dir (concat doom-etc-dir "rust/")
"The path to Rust source library. Required by racer.")
;;
;; Plugins
;;
@ -20,19 +16,16 @@
(def-package! racer
:after rust-mode
:hook (rust-mode . racer-mode)
:config
(add-hook 'rust-mode-hook #'eldoc-mode)
(setq racer-cmd (or (executable-find "racer")
(expand-file-name "racer/target/release/racer" +rust-src-dir))
racer-rust-src-path (or (getenv "RUST_SRC_PATH")
(expand-file-name "rust/src/" +rust-src-dir)))
(unless (file-exists-p racer-cmd)
(warn! "Couldn't find racer binary. Code completion won't work"))
(unless (file-directory-p racer-rust-src-path)
(warn! "Couldn't find rust source. Code completion won't work"))
(set! :lookup 'rust-mode :definition #'racer-find-definition))
(add-hook! 'rust-mode-hook #'(eldoc-mode racer-mode))
(set! :lookup 'rust-mode
:definition #'racer-find-definition
:documentation #'racer-describe))
(def-package! company-racer