branch: elpa/swift-mode
commit 13628495bdb2dcf30eea04412e1d3e3c80b8e999
Author: taku0 <mxxouy6x3m_git...@tatapa.org>
Commit: taku0 <mxxouy6x3m_git...@tatapa.org>

    Use `seq-mapcat` instead of `apply` '`nonc` and `mapcar`
---
 swift-mode-imenu.el | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/swift-mode-imenu.el b/swift-mode-imenu.el
index f7c168d..de575a1 100644
--- a/swift-mode-imenu.el
+++ b/swift-mode-imenu.el
@@ -377,21 +377,19 @@ and \"c\".
   "Convert list of DECLARATIONS to alist for `imenu--index-alist'.
 
 Declarations are organized as trees."
-  (apply
-   'nconc
-   (mapcar
-    (lambda (declaration)
-      (let* ((name-token (swift-mode:declaration:name-token declaration))
-             (name (swift-mode:token:text name-token))
-             (position (swift-mode:token:start name-token))
-             (children (swift-mode:declaration:children declaration)))
-        (cons
-         (cons name position)
-         (mapcar
-          (lambda (pair)
-            (cons (concat name "." (car pair)) (cdr pair)))
-          (swift-mode:format-for-imenu:flat children)))))
-    declarations)))
+  (seq-mapcat
+   (lambda (declaration)
+     (let* ((name-token (swift-mode:declaration:name-token declaration))
+            (name (swift-mode:token:text name-token))
+            (position (swift-mode:token:start name-token))
+            (children (swift-mode:declaration:children declaration)))
+       (cons
+        (cons name position)
+        (mapcar
+         (lambda (pair)
+           (cons (concat name "." (car pair)) (cdr pair)))
+         (swift-mode:format-for-imenu:flat children)))))
+   declarations))
 
 (defun swift-mode:format-for-imenu:nested (declarations)
   "Convert list of DECLARATIONS to alist for `imenu--index-alist'.

Reply via email to