Skip to content

Commit d0c6e27

Browse files
committed
Cleanup: move variable assignment out of the loop
It never changes inside this function, so there's no need to recompute it with every loop iteration.
1 parent 6478bf4 commit d0c6e27

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/gui/controllers/files_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,13 +1221,14 @@ func normalisedSelectedNodes(selectedNodes []*filetree.FileNode) []*filetree.Fil
12211221
}
12221222

12231223
func isDescendentOfSelectedNodes(node *filetree.FileNode, selectedNodes []*filetree.FileNode) bool {
1224+
nodePath := node.GetPath()
1225+
12241226
for _, selectedNode := range selectedNodes {
12251227
if selectedNode.IsFile() {
12261228
continue
12271229
}
12281230

12291231
selectedNodePath := selectedNode.GetPath()
1230-
nodePath := node.GetPath()
12311232

12321233
if strings.HasPrefix(nodePath, selectedNodePath+"/") {
12331234
return true

0 commit comments

Comments
 (0)