]> git.eshelyaron.com Git - emacs.git/commitdiff
ruby-mode: eliminate redundant regexp branch
authorMattias Engdegård <mattiase@acm.org>
Tue, 5 Jan 2021 11:01:32 +0000 (12:01 +0100)
committerMattias Engdegård <mattiase@acm.org>
Tue, 5 Jan 2021 11:01:32 +0000 (12:01 +0100)
* lisp/progmodes/ruby-mode.el (ruby-add-log-current-method):
Since ruby-operator-re matches dot, don't include both in regexp.
This pacifies relint.

lisp/progmodes/ruby-mode.el

index cd9d087856ceab582e8cb5d78c49bc7ea2ad0a09..a8667acb9d5c7684854c323858d3ad5055bf3c39 100644 (file)
@@ -1603,9 +1603,9 @@ See `add-log-current-defun-function'."
                           "\\("
                           ;; \\. and :: for class methods
                           "\\([A-Za-z_]" ruby-symbol-re "*[?!]?"
-                          (when method-name? "\\|")
-                          (when method-name? ruby-operator-re)
-                          "\\|\\.\\|::" "\\)"
+                          "\\|"
+                          (if method-name? ruby-operator-re "\\.")
+                          "\\|::" "\\)"
                           "+\\)")))
                (definition-re (funcall make-definition-re ruby-defun-beg-re t))
                (module-re (funcall make-definition-re "\\(class\\|module\\)")))