   (interactive)
   (unless (executable-find rust-rustfmt-bin)
     (error "Could not locate executable \%s\"" rust-rustfmt-bin))
-  (let ((proc
-         (start-process "rustfmt-diff"
-                        (with-current-buffer
-                            (get-buffer-create "*rustfmt-diff*")
-                          (let ((inhibit-read-only t))
-                            (erase-buffer))
-                          (current-buffer))
-                        rust-rustfmt-bin
-                        "--check"
-                        (buffer-file-name))))
+  (let* ((buffer
+          (with-current-buffer
+              (get-buffer-create "*rustfmt-diff*")
+            (let ((inhibit-read-only t))
+              (erase-buffer))
+            (current-buffer)))
+         (proc
+          (apply 'start-process
+                 "rustfmt-diff"
+                 buffer
+                 rust-rustfmt-bin
+                 "--check"
+                 (cons (buffer-file-name)
+                       rust-rustfmt-switches))))
     (set-process-sentinel proc 'rust-format-diff-buffer-sentinel)
     proc))
 

(defcustom rust-rustfmt-bin "rustfmt"
  "Path to rustfmt executable."
  :type 'string
  :group 'rust-mode)

(defcustom rust-cargo-bin "cargo"

    (erase-buffer)
    (insert-buffer-substring buf)
    (let* ((tmpf (make-temp-file "rustfmt"))
           (ret (apply 'call-process-region
                       (point-min)
                       (point-max)
                       rust-rustfmt-bin
                       t
                       `(t ,tmpf)
                       nil
                       rust-rustfmt-switches)))
      (unwind-protect
          (cond
           ((zerop ret)
