doomemacs/modules/lang/rust/config.el
Henrik Lissner 09cb4f6716
Major refactor & optimization of how modules load their packages
Now that we are loading package autoloads files (as part of the
generated doom-package-autoload-file when running make autoloads), many
:commands properties are redundant. In fact, many def-package! blocks
are redundant.

In some cases, we can do without a config.el file entirely, and can move
into the autoloads file or rely entirely on package autoloads.

Also, many settings have been moved in their module's autoloads files,
which makes them available ASAP; their use no longer depends on module
load order.

This gained me a modest ~10% boost in startup speed.
2018-05-25 00:46:16 +02:00

39 lines
1,008 B
EmacsLisp

;;; lang/rust/config.el -*- lexical-binding: t; -*-
(after! rust-mode
(set! :env "RUST_SRC_PATH")
(set! :docset 'rust-mode "Rust")
(setq rust-indent-method-chain t)
(map! :map rust-mode-map
:localleader
:n "b" #'+rust/build-menu)
(def-menu! +rust/build-menu
"TODO"
'(("cargo run" :exec "cargo run --color always")
("cargo build" :exec "cargo build --color always")
("cargo test" :exec "cargo test --color always"))
:prompt "Cargo: "))
(def-package! racer
:after rust-mode
:config
(add-hook 'rust-mode-hook #'racer-mode)
(set! :lookup 'rust-mode
:definition #'racer-find-definition
:documentation #'racer-describe))
(def-package! company-racer
:when (featurep! :completion company)
:after racer
:config (set! :company-backend 'rust-mode '(company-racer)))
(def-package! flycheck-rust
:when (featurep! :feature syntax-checker)
:after rust-mode
:config (add-hook! 'rust-mode-hook #'(flycheck-mode flycheck-rust-setup)))