From f752f2ddf45c3a1655905e663d487a801b0057f3 Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Thu, 12 Oct 2023 09:23:31 +0800 Subject: [PATCH] Remove redundant `len` check in `GroupSheets` and `UngroupSheets` (#1685) --- sheet.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sheet.go b/sheet.go index 5672484..6166773 100644 --- a/sheet.go +++ b/sheet.go @@ -1739,11 +1739,8 @@ func (f *File) GroupSheets(sheets []string) error { } for _, ws := range wss { sheetViews := ws.SheetViews.SheetView - if len(sheetViews) > 0 { - for idx := range sheetViews { - ws.SheetViews.SheetView[idx].TabSelected = true - } - continue + for idx := range sheetViews { + ws.SheetViews.SheetView[idx].TabSelected = true } } return nil @@ -1758,10 +1755,8 @@ func (f *File) UngroupSheets() error { } ws, _ := f.workSheetReader(sheet) sheetViews := ws.SheetViews.SheetView - if len(sheetViews) > 0 { - for idx := range sheetViews { - ws.SheetViews.SheetView[idx].TabSelected = false - } + for idx := range sheetViews { + ws.SheetViews.SheetView[idx].TabSelected = false } } return nil