summaryrefslogtreecommitdiff
path: root/init/flycheck/init-flycheck-cargo-has-command-p-fix.el
diff options
context:
space:
mode:
Diffstat (limited to 'init/flycheck/init-flycheck-cargo-has-command-p-fix.el')
-rw-r--r--init/flycheck/init-flycheck-cargo-has-command-p-fix.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/init/flycheck/init-flycheck-cargo-has-command-p-fix.el b/init/flycheck/init-flycheck-cargo-has-command-p-fix.el
new file mode 100644
index 0000000..48d53d6
--- /dev/null
+++ b/init/flycheck/init-flycheck-cargo-has-command-p-fix.el
@@ -0,0 +1,7 @@
+(defun init-flycheck-rust-cargo-has-command-p (command)
+ (let* ((commands (process-lines "cargo" "--list"))
+ (trimmed (-map (lambda (row) (-slice row 4 (string-search " " 4))) commands)))
+ (seq-contains-p (-rest trimmed) command)))
+
+(advice-add 'flycheck-rust-cargo-has-command-p
+ :override 'init-flycheck-rust-cargo-has-command-p)