diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-19 19:51:48 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-24 20:14:41 +1100 |
commit | 94a53484a183bb32b066dc51fb90948dead634a1 (patch) | |
tree | 51e76a607b68a309c3e7573432392b125a3e2783 /pkg/gui/filetree | |
parent | 1b75ed37403ac2997cb6a5ede92d87f1a1eb96b1 (diff) |
would you believe that I'm adding even more generics
Diffstat (limited to 'pkg/gui/filetree')
-rw-r--r-- | pkg/gui/filetree/inode.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/pkg/gui/filetree/inode.go b/pkg/gui/filetree/inode.go index 48cdc3be3..d59315b28 100644 --- a/pkg/gui/filetree/inode.go +++ b/pkg/gui/filetree/inode.go @@ -200,10 +200,7 @@ func getLeaves(node INode) []INode { return []INode{node} } - output := []INode{} - for _, child := range node.GetChildren() { - output = append(output, getLeaves(child)...) - } - - return output + return slices.FlatMap(node.GetChildren(), func(child INode) []INode { + return getLeaves(child) + }) } |