emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 1433a12: ruby-mode: eliminate redundant regexp branch


From: Mattias Engdegård
Subject: master 1433a12: ruby-mode: eliminate redundant regexp branch
Date: Tue, 5 Jan 2021 06:14:37 -0500 (EST)

branch: master
commit 1433a1201447f6f8b610f4d7f78a4b8a739c6572
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    ruby-mode: eliminate redundant regexp branch
    
    * 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 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index cd9d087..a8667ac 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -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\\)")))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]