From e6e00a904689254ab75ec104af53cefafd9676de Mon Sep 17 00:00:00 2001 From: Mysh! Date: Tue, 8 Oct 2019 16:19:48 +0800 Subject: [PATCH] Fix redundant return statement Fix redundant return statement and unused branch Once more fixing redundant return Fix redundant return statement Fix redundant return statement --- context.go | 1 - drawing.go | 19 ++----------------- text.go | 1 - 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/context.go b/context.go index 7a90547..5d2b008 100644 --- a/context.go +++ b/context.go @@ -62,7 +62,6 @@ func contextAllCommands(ctx *context) { } } ctx.cmds = append(ctx.cmds, ctx.finalCmds.Commands...) - return } func (ctx *context) setupMasterWindow(layout *panel, updatefn UpdateFn) { diff --git a/drawing.go b/drawing.go index be3aa1d..5c966d8 100644 --- a/drawing.go +++ b/drawing.go @@ -120,9 +120,6 @@ func (dwh *drawableWindowHeader) Draw(z *nstyle.Style, out *command.Buffer) { background = &style.Header.Normal text.Text = style.Header.LabelNormal } - if dwh.Hovered { - } else { - } /* draw header background */ if background.Type == nstyle.ItemImage { @@ -136,7 +133,6 @@ func (dwh *drawableWindowHeader) Draw(z *nstyle.Style, out *command.Buffer) { text.Padding = image.Point{0, 0} widgetText(out, dwh.Label, dwh.Title, &text, "LC", z.Font) } - return } type drawableWindowBody struct { @@ -155,7 +151,6 @@ func (dwb *drawableWindowBody) Draw(z *nstyle.Style, out *command.Buffer) { if !dwb.NoScrollbar { out.Clip.W += dwb.Style.ScrollbarSize.X } - return } type drawableScalerAndBorders struct { @@ -200,7 +195,7 @@ func (d *drawableScalerAndBorders) Draw(z *nstyle.Style, out *command.Buffer) { /* draw right border */ out.StrokeLine(image.Point{d.Bounds.X + d.Bounds.W - d.Border, d.Bounds.Y + d.Border/2.0}, image.Point{d.Bounds.X + d.Bounds.W - d.Border, d.PaddingY - d.Border}, d.Border, d.BorderColor) } - return + } /////////////////////////////////////////////////////////////////////////////////// @@ -293,7 +288,7 @@ func drawTextButton(win *Window, bounds rect.Rect, content rect.Rect, state nsty } widgetText(out, content, txt, &text, align, font) - return + } func drawSymbolButton(win *Window, bounds rect.Rect, content rect.Rect, state nstyle.WidgetStates, style *nstyle.Button, symbol label.SymbolType) { @@ -328,7 +323,6 @@ func drawSymbolButton(win *Window, bounds rect.Rect, content rect.Rect, state ns sym = style.TextNormal } drawSymbol(out, symbol, content, bg, sym, style.SymbolBorderWidth, font) - return } func drawImageButton(win *Window, bounds rect.Rect, content rect.Rect, state nstyle.WidgetStates, style *nstyle.Button, img *image.RGBA) { @@ -345,7 +339,6 @@ func drawImageButton(win *Window, bounds rect.Rect, content rect.Rect, state nst } drawButton(out, bounds, state, style) out.DrawImage(content, img) - return } func drawTextSymbolButton(win *Window, bounds, labelrect, symbolrect rect.Rect, state nstyle.WidgetStates, style *nstyle.Button, str string, symbol label.SymbolType) { @@ -389,7 +382,6 @@ func drawTextSymbolButton(win *Window, bounds, labelrect, symbolrect rect.Rect, text.Padding = image.Point{0, 0} drawSymbol(out, symbol, symbolrect, style.TextBackground, sym, 0, font) widgetText(out, labelrect, str, &text, "CC", font) - return } func drawTextImageButton(win *Window, bounds, labelrect, imgrect rect.Rect, state nstyle.WidgetStates, style *nstyle.Button, str string, img *image.RGBA) { @@ -427,7 +419,6 @@ func drawTextImageButton(win *Window, bounds, labelrect, imgrect rect.Rect, stat text.Padding = image.Point{0, 0} widgetText(out, labelrect, str, &text, "CC", font) out.DrawImage(imgrect, img) - return } /////////////////////////////////////////////////////////////////////////////////// @@ -488,7 +479,6 @@ func drawSelectable(win *Window, state nstyle.WidgetStates, style *nstyle.Select } widgetText(out, bounds, str, &text, align, font) - return } /////////////////////////////////////////////////////////////////////////////////// @@ -536,7 +526,6 @@ func drawScrollbar(win *Window, state nstyle.WidgetStates, style *nstyle.Scrollb } else { out.FillRect(scroll, style.Rounding, cursorstyle.Data.Color) } - return } /////////////////////////////////////////////////////////////////////////////////// @@ -612,7 +601,6 @@ func drawTogglebox(win *Window, type_ toggleType, state nstyle.WidgetStates, sty text.Padding.Y = 0 text.Background = style.TextBackground widgetText(out, labelrect, str, &text, "LC", font) - return } /////////////////////////////////////////////////////////////////////////////////// @@ -661,7 +649,6 @@ func drawProgress(win *Window, state nstyle.WidgetStates, style *nstyle.Progress } else { out.FillRect(scursor, style.Rounding, cursor.Data.Color) } - return } /////////////////////////////////////////////////////////////////////////////////// @@ -741,7 +728,6 @@ func drawSlider(win *Window, state nstyle.WidgetStates, style *nstyle.Slider, bo } else { out.FillCircle(scursor, cursor.Data.Color) } - return } /////////////////////////////////////////////////////////////////////////////////// @@ -790,7 +776,6 @@ func drawProperty(win *Window, style *nstyle.Property, bounds, labelrect rect.Re // draw label widgetText(out, labelrect, name, &text, "CC", font) - return } /////////////////////////////////////////////////////////////////////////////////// diff --git a/text.go b/text.go index b062206..b9ac0c1 100644 --- a/text.go +++ b/text.go @@ -1677,7 +1677,6 @@ func (d *drawableTextEditor) Draw(z *nstyle.Style, out *command.Buffer) { } out.PushScissor(old_clip) - return } func runeSliceEquals(a, b []rune) bool {