lint: remove ineffectual assignments (ineffassign)

Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Moritz Poldrack 2022-07-29 21:25:56 +02:00 committed by Robin Jarry
parent 2534612c59
commit 03f9f4c3ab
4 changed files with 4 additions and 8 deletions

View File

@ -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))
}
}
}

View File

@ -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
}

View File

@ -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!)")
}
}

View File

@ -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 {