all: apply suggestions from staticcheck.io

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-06-03 12:22:52 +02:00
committed by Elias Naur
parent 11192a5142
commit 916efb4612
13 changed files with 7 additions and 219 deletions
+1 -10
View File
@@ -100,7 +100,6 @@ func computeGlyphClusters(l *text.Layout) {
clusters = append(clusters, newlineCluster)
}
l.Clusters = clusters
return
}
// langConfig describes the language and writing system of a body of text.
@@ -396,10 +395,6 @@ func toGioGlyphs(in []shaping.Glyph) []text.Glyph {
// ToLine converts the output into a text.Line
func (o output) ToLine() text.Line {
advances := make([]fixed.Int26_6, 0, len(o.Shaped.Glyphs))
for _, glyph := range o.Shaped.Glyphs {
advances = append(advances, glyph.XAdvance)
}
layout := text.Layout{
Glyphs: toGioGlyphs(o.Shaped.Glyphs),
Runes: o.RuneRange,
@@ -458,11 +453,7 @@ func Document(shaper Shaper, face font.Face, ppem fixed.Int26_6, maxWidth int, l
}
paragraphText = append(paragraphText, r)
script := language.LookupScript(r)
if _, ok := langs[script]; ok {
langs[script]++
} else {
langs[script] = 1
}
langs[script]++
bytes += sz
runes++
if r == '\n' {
-2
View File
@@ -890,7 +890,6 @@ func TestEngineLineWrap(t *testing.T) {
func TestEngineDocument(t *testing.T) {
const doc = `Rutrum quisque non tellus orci ac auctor augue.
At risus viverra adipiscing at.`
const numLines = 2
english := system.Locale{
Language: "EN",
Direction: system.LTR,
@@ -980,7 +979,6 @@ func TestLayoutComputeClusters(t *testing.T) {
type testcase struct {
name string
line text.Layout
lastLine bool
expected []text.GlyphCluster
}
for _, tc := range []testcase{