소스 검색

refactor: return nil outside the switch statement

ayn2op 1 년 전
부모
커밋
3cafdcddef
1개의 변경된 파일1개의 추가작업 그리고 8개의 파일을 삭제
  1. 1 8
      cmd/app.go

+ 1 - 8
cmd/app.go

@@ -104,13 +104,10 @@ func (app *App) onFlexInputCapture(event *tcell.EventKey) *tcell.EventKey {
 	switch event.Name() {
 	case app.cfg.Keys.FocusGuildsTree:
 		app.SetFocus(app.guildsTree)
-		return nil
 	case app.cfg.Keys.FocusMessagesText:
 		app.SetFocus(app.messagesText)
-		return nil
 	case app.cfg.Keys.FocusMessageInput:
 		app.SetFocus(app.messageInput)
-		return nil
 	case app.cfg.Keys.Logout:
 		app.Stop()
 
@@ -118,8 +115,6 @@ func (app *App) onFlexInputCapture(event *tcell.EventKey) *tcell.EventKey {
 			slog.Error("failed to delete token from keyring", "err", err)
 			return nil
 		}
-
-		return nil
 	case app.cfg.Keys.ToggleGuildsTree:
 		// The guilds tree is visible if the numbers of items is two.
 		if app.flex.GetItemCount() == 2 {
@@ -132,9 +127,7 @@ func (app *App) onFlexInputCapture(event *tcell.EventKey) *tcell.EventKey {
 			app.init()
 			app.SetFocus(app.guildsTree)
 		}
-
-		return nil
 	}
 
-	return event
+	return nil
 }