Fix linter warnings

* Remove redundant return (code was never reached)
* Remove redundant type information
* Rename unused function parameters to "_"
This commit is contained in:
Reto Brunner 2021-02-26 22:10:26 +01:00
parent fda424bebc
commit 8b4f2d148c
4 changed files with 8 additions and 9 deletions

View file

@ -97,7 +97,6 @@ func findNextNonDeleted(deleted []uint32, store *lib.MessageStore) *models.Messa
} }
return next return next
} }
return nil // Never reached
} }
func contains(uids []uint32, uid uint32) bool { func contains(uids []uint32, uid uint32) bool {

View file

@ -132,7 +132,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
return return
} }
composer.AddAttachment(tmpFileName) composer.AddAttachment(tmpFileName)
composer.OnClose(func(composer *widgets.Composer) { composer.OnClose(func(_ *widgets.Composer) {
os.RemoveAll(tmpDir) os.RemoveAll(tmpDir)
}) })
}) })

View file

@ -10,19 +10,19 @@ func TestParseUnsubscribe(t *testing.T) {
expected []string expected []string
} }
cases := []*tc{ cases := []*tc{
&tc{"", []string{}}, {"", []string{}},
&tc{"invalid", []string{}}, {"invalid", []string{}},
&tc{"<https://example.com>, <http://example.com>", []string{ {"<https://example.com>, <http://example.com>", []string{
"https://example.com", "http://example.com", "https://example.com", "http://example.com",
}}, }},
&tc{"<https://example.com> is a URL", []string{ {"<https://example.com> is a URL", []string{
"https://example.com", "https://example.com",
}}, }},
&tc{"<mailto:user@host?subject=unsubscribe>, <https://example.com>", {"<mailto:user@host?subject=unsubscribe>, <https://example.com>",
[]string{ []string{
"mailto:user@host?subject=unsubscribe", "https://example.com", "mailto:user@host?subject=unsubscribe", "https://example.com",
}}, }},
&tc{"<>, <https://example> ", []string{ {"<>, <https://example> ", []string{
"", "https://example", "", "https://example",
}}, }},
} }

View file

@ -594,7 +594,7 @@ func (store *MessageStore) Sort(criteria []*types.SortCriterion, cb func()) {
store.Sorting = true store.Sorting = true
store.worker.PostAction(&types.FetchDirectoryContents{ store.worker.PostAction(&types.FetchDirectoryContents{
SortCriteria: criteria, SortCriteria: criteria,
}, func(msg types.WorkerMessage) { }, func(_ types.WorkerMessage) {
store.Sorting = false store.Sorting = false
if cb != nil { if cb != nil {
cb() cb()