From 03f9f4c3ab633f3b567813b55b90ba9aac604e3e Mon Sep 17 00:00:00 2001 From: Moritz Poldrack Date: Fri, 29 Jul 2022 21:25:56 +0200 Subject: [PATCH] lint: remove ineffectual assignments (ineffassign) Signed-off-by: Moritz Poldrack Acked-by: Robin Jarry --- widgets/authinfo.go | 5 ++--- widgets/dirtree.go | 3 --- widgets/pgpinfo.go | 2 +- worker/mbox/worker.go | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/widgets/authinfo.go b/widgets/authinfo.go index 878a0c3..e773240 100644 --- a/widgets/authinfo.go +++ b/widgets/authinfo.go @@ -23,14 +23,13 @@ func NewAuthInfo(auth *auth.Details, showInfo bool, uiConfig *config.UIConfig) * func (a *AuthInfo) Draw(ctx *ui.Context) { defaultStyle := a.uiConfig.GetStyle(config.STYLE_DEFAULT) - style := a.uiConfig.GetStyle(config.STYLE_DEFAULT) ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', defaultStyle) var text string if a.authdetails == nil { text = "(no header)" ctx.Printf(0, 0, defaultStyle, text) } else if a.authdetails.Err != nil { - style = a.uiConfig.GetStyle(config.STYLE_ERROR) + style := a.uiConfig.GetStyle(config.STYLE_ERROR) text = a.authdetails.Err.Error() ctx.Printf(0, 0, style, text) } else { @@ -81,7 +80,7 @@ func (a *AuthInfo) Draw(ctx *ui.Context) { if checkBounds(x) && infoText != "" { if trunc := ctx.Width() - x - 3; trunc > 0 { text = runewidth.Truncate(infoText, trunc, "…") - x += ctx.Printf(x, 0, defaultStyle, fmt.Sprintf(" (%s)", text)) + ctx.Printf(x, 0, defaultStyle, fmt.Sprintf(" (%s)", text)) } } } diff --git a/widgets/dirtree.go b/widgets/dirtree.go index e540434..f135a0c 100644 --- a/widgets/dirtree.go +++ b/widgets/dirtree.go @@ -375,9 +375,6 @@ func buildTree(node *types.Thread, stree [][]string, defaultUid uint32) { for _, branch := range stree { if len(branch) > 1 { var next [][]string - if _, ok := m[branch[0]]; !ok { - next = make([][]string, 0) - } next = append(m[branch[0]], branch[1:]) m[branch[0]] = next } diff --git a/widgets/pgpinfo.go b/widgets/pgpinfo.go index 3dd3fbb..ee2a026 100644 --- a/widgets/pgpinfo.go +++ b/widgets/pgpinfo.go @@ -71,7 +71,7 @@ func (p *PGPInfo) DrawEncryption(ctx *ui.Context, y int) { x := ctx.Printf(0, y, validStyle, "%s Encrypted", icon) x += ctx.Printf(x+1, y, defaultStyle, "To %s (%8X) ", p.details.DecryptedWith, p.details.DecryptedWithKeyId) if !p.details.IsSigned { - x += ctx.Printf(x, y, warningStyle, "(message not signed!)") + ctx.Printf(x, y, warningStyle, "(message not signed!)") } } diff --git a/worker/mbox/worker.go b/worker/mbox/worker.go index 6ba886a..ab16f91 100644 --- a/worker/mbox/worker.go +++ b/worker/mbox/worker.go @@ -50,7 +50,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { reterr = err break } - dir := u.Path + var dir string if u.Host == "~" { home, err := os.UserHomeDir() if err != nil {