News for hackers. Stuff that matters.
Re:Rust for Clojurists (2015) by creese on Friday October 30, 2020 @03:03PM (#24945679)
I've found I can get the same tight feedback loop at least for the times where the code will not compile. I use Cargo mode and an after-save hook so that each save runs `cargo check` and, on success, also runs `cargo fmt`. A nice side effect is that I don't need to care about formatting any more.

  (defun cargo-process-check-sentinel (process event)
    (when (string= "finished\n" event)
      (rust-format-buffer)))

  (defun my-after-save-hook ()
    (when (eq major-mode 'rust-mode)
      (set-process-sentinel (cargo-process-check) 'cargo-process-check-sentinel)))

  (add-hook 'after-save-hook #'my-after-save-hook)

There are no comments on this comment yet.