From 8b4f2d148c8519326f306fd14ba872d7cb3101c6 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Fri, 26 Feb 2021 22:10:26 +0100 Subject: [PATCH] Fix linter warnings * Remove redundant return (code was never reached) * Remove redundant type information * Rename unused function parameters to "_" --- commands/msg/delete.go | 1 - commands/msg/forward.go | 2 +- commands/msg/unsubscribe_test.go | 12 ++++++------ lib/msgstore.go | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/commands/msg/delete.go b/commands/msg/delete.go index baa5011..677a666 100644 --- a/commands/msg/delete.go +++ b/commands/msg/delete.go @@ -97,7 +97,6 @@ func findNextNonDeleted(deleted []uint32, store *lib.MessageStore) *models.Messa } return next } - return nil // Never reached } func contains(uids []uint32, uid uint32) bool { diff --git a/commands/msg/forward.go b/commands/msg/forward.go index 475d680..edade6d 100644 --- a/commands/msg/forward.go +++ b/commands/msg/forward.go @@ -132,7 +132,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { return } composer.AddAttachment(tmpFileName) - composer.OnClose(func(composer *widgets.Composer) { + composer.OnClose(func(_ *widgets.Composer) { os.RemoveAll(tmpDir) }) }) diff --git a/commands/msg/unsubscribe_test.go b/commands/msg/unsubscribe_test.go index e4e6f25..d34efb1 100644 --- a/commands/msg/unsubscribe_test.go +++ b/commands/msg/unsubscribe_test.go @@ -10,19 +10,19 @@ func TestParseUnsubscribe(t *testing.T) { expected []string } cases := []*tc{ - &tc{"", []string{}}, - &tc{"invalid", []string{}}, - &tc{", ", []string{ + {"", []string{}}, + {"invalid", []string{}}, + {", ", []string{ "https://example.com", "http://example.com", }}, - &tc{" is a URL", []string{ + {" is a URL", []string{ "https://example.com", }}, - &tc{", ", + {", ", []string{ "mailto:user@host?subject=unsubscribe", "https://example.com", }}, - &tc{"<>, ", []string{ + {"<>, ", []string{ "", "https://example", }}, } diff --git a/lib/msgstore.go b/lib/msgstore.go index b95b68f..7af9fd2 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -594,7 +594,7 @@ func (store *MessageStore) Sort(criteria []*types.SortCriterion, cb func()) { store.Sorting = true store.worker.PostAction(&types.FetchDirectoryContents{ SortCriteria: criteria, - }, func(msg types.WorkerMessage) { + }, func(_ types.WorkerMessage) { store.Sorting = false if cb != nil { cb()