 (define-derived-mode rust-mode rust-parent-mode "Rust"
   "Major mode for Rust code."
   :group 'rust-mode
-
-  ;; Basic syntax
-  (set-syntax-table rust-mode-syntax-table)
+  :syntax-table rust-mode-syntax-table
 
   ;; Indentation
-  (set (make-local-variable 'indent-line-function)
-       'rust-mode-indent-line)
+  (setq-local indent-line-function 'rust-mode-indent-line)
 
   ;; Fonts
-  (set (make-local-variable 'font-lock-defaults)
-       '(rust-mode-font-lock-keywords nil nil nil nil))
+  (setq-local font-lock-defaults '(rust-mode-font-lock-keywords nil nil nil nil))
 
   ;; Misc
-  (set (make-local-variable 'comment-start) "// ")
-  (set (make-local-variable 'comment-end)   "")
-  (set (make-local-variable 'indent-tabs-mode) nil)
+  (setq-local comment-start "// ")
+  (setq-local comment-end   "")
+  (setq-local indent-tabs-mode nil)
 
   ;; Allow paragraph fills for comments
-  (set (make-local-variable 'comment-start-skip)
-       "\\(?://[/!]*\\|/\\*[*!]?\\)[[:space:]]*")
-  (set (make-local-variable 'paragraph-start)
+  (setq-local comment-start-skip "\\(?://[/!]*\\|/\\*[*!]?\\)[[:space:]]*")
+  (setq-local paragraph-start
        (concat "[[:space:]]*\\(?:" comment-start-skip "\\|\\*/?[[:space:]]*\\|\\)$"))
-  (set (make-local-variable 'paragraph-separate) paragraph-start)
-  (set (make-local-variable 'normal-auto-fill-function) 'rust-do-auto-fill)
-  (set (make-local-variable 'fill-paragraph-function) 'rust-fill-paragraph)
-  (set (make-local-variable 'fill-forward-paragraph-function) 'rust-fill-forward-paragraph)
-  (set (make-local-variable 'adaptive-fill-function) 'rust-find-fill-prefix)
-  (set (make-local-variable 'comment-multi-line) t)
-  (set (make-local-variable 'comment-line-break-function) 'rust-comment-indent-new-line)
-  (set (make-local-variable 'imenu-generic-expression) rust-imenu-generic-expression)
-  (set (make-local-variable 'beginning-of-defun-function) 'rust-beginning-of-defun)
-  (set (make-local-variable 'end-of-defun-function) 'rust-end-of-defun)
-  )
-
+  (setq-local paragraph-separate paragraph-start)
+  (setq-local normal-auto-fill-function 'rust-do-auto-fill)
+  (setq-local fill-paragraph-function 'rust-fill-paragraph)
+  (setq-local fill-forward-paragraph-function 'rust-fill-forward-paragraph)
+  (setq-local adaptive-fill-function 'rust-find-fill-prefix)
+  (setq-local comment-multi-line t)
+  (setq-local comment-line-break-function 'rust-comment-indent-new-line)
+  (setq-local imenu-generic-expression rust-imenu-generic-expression)
+  (setq-local beginning-of-defun-function 'rust-beginning-of-defun)
+  (setq-local end-of-defun-function 'rust-end-of-defun))
 
 ;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.rs$" . rust-mode))
+(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
 
 (defun rust-mode-reload ()
   (interactive)
   (unload-feature 'rust-mode)
   (require 'rust-mode)
   (rust-mode))
-
-(provide 'rust-mode)
 
 ;; Issue #6887: Rather than inheriting the 'gnu compilation error
 ;; regexp (which is broken on a few edge cases), add our own 'rust

;; Version: 0.2.0
;; Author: Mozilla
;; Url: https://github.com/mozilla/rust

(eval-when-compile (require 'cl))
(eval-when-compile (require 'misc))

;; Syntax definitions and helpers
(defvar rust-mode-syntax-table
  (let ((table (make-syntax-table)))

    ;; Operators
    (loop for i in '(?+ ?- ?* ?/ ?& ?| ?^ ?! ?< ?> ?~ ?@)
          do (modify-syntax-entry i "." table))

    ;; Strings
    (modify-syntax-entry ?\" "\"" table)

                  (cons 'rustc rustc-compilation-regexps))
     (add-to-list 'compilation-error-regexp-alist 'rustc)))

(provide 'rust-mode)

;;; rust-mode.el ends here
