<commit_before>;;; lang/rust/config.el -*- lexical-binding: t; -*-

(after! rust-mode
  (set-env! "RUST_SRC_PATH")
  (set-docsets! 'rust-mode "Rust")
  (setq rust-indent-method-chain t)

  (map! :map rust-mode-map
        :localleader
        :prefix "b"
        :n "b" (λ! (compile "cargo build --color always"))
        :n "r" (λ! (compile "cargo run --color always"))
        :n "t" (λ! (compile "cargo test --color always"))))


(def-package! racer
  :after rust-mode
  :config
  (add-hook 'rust-mode-hook #'racer-mode)
  (set-lookup-handlers! '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-rust-setup))<commit_msg>lang/rust: add `cargo check` localleader keybind<commit_after>;;; lang/rust/config.el -*- lexical-binding: t; -*-

(after! rust-mode
  (set-env! "RUST_SRC_PATH")
  (set-docsets! 'rust-mode "Rust")
  (setq rust-indent-method-chain t)

  (map! :map rust-mode-map
        :localleader
        :prefix "b"
        :n "b" (λ! (compile "cargo build --color always"))
        :n "c" (λ! (compile "cargo check --color always"))
        :n "r" (λ! (compile "cargo run --color always"))
        :n "t" (λ! (compile "cargo test --color always"))))


(def-package! racer
  :after rust-mode
  :config
  (add-hook 'rust-mode-hook #'racer-mode)
  (set-lookup-handlers! '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-rust-setup))
{'fraction_non_alphanumeric': 0.1748743718592965, 'fraction_numerical': 0.0, 'mean_word_length': 3.337690631808279, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5366670', 'n_tokens_mistral': 745, 'n_tokens_neox': 727, 'n_words': 176}