   :group 'rust-mode)
 
 (defcustom racer-cmd
-  (if (locate-file "racer" exec-path)
-      (locate-file "racer" exec-path)
-    "/usr/local/bin/racer")
+  (or (executable-find "racer") "/usr/local/bin/racer")
   "Path to the racer binary."
   :type 'file
   :group 'racer)
 
 (defcustom racer-rust-src-path
-  (if (getenv "RUST_SRC_PATH")
-      (getenv "RUST_SRC_PATH")
-    "/usr/local/src/rust/src")
+  (or (getenv "RUST_SRC_PATH") "/usr/local/src/rust/src")
   "Path to the rust source tree."
   :type 'file
   :group 'racer)

            (push completion racer-completion-results))))
      racer-completion-results)))

(defun racer--prefix ()
  "Run the racer prefix command and process the results."
  (let ((racer-tmp-file-name (make-temp-file "racer")))
    (racer--write-tmp-file racer-tmp-file-name)
    (setenv "RUST_SRC_PATH" (expand-file-name racer-rust-src-path))
    (let ((lines (process-lines racer-cmd
                                "prefix"
                                (number-to-string (racer-get-line-number))
                                (number-to-string (current-column))
                                racer-tmp-file-name)))
      (delete-file racer-tmp-file-name)
      (when (string-match "^PREFIX \\(.+\\),\\(.+\\),\\(.*\\)$" (nth 0 lines))
        (match-string 3 (nth 0 lines))))))

(defun racer--company-prefix ()
    "Returns the symbol to complete. If racer-begin-after-member-access is t,
begins completion automatically if the cursor is followed by a dot or ::."

  (set (make-local-variable 'company-backends) '(racer-company-complete)))

(defun racer--syntax-highlight (str)
  "Apply font-lock properties to a string STR of Rust code."
  (with-temp-buffer
    (insert str)
    (delay-mode-hooks (rust-mode))
    (font-lock-fontify-buffer)
    (buffer-string)))

(defun racer--goto-func-name ()
  "If point is inside a function call, move to the function name.
