🎨 Remove redundant slice assignment

This commit is contained in:
Liang Ding 2019-08-09 23:46:25 +08:00
parent 6f6884271d
commit 0c44174564
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -116,24 +116,12 @@ func (b *tableParagraphTransformer) parseDelimiter(segment text.Segment, reader
var alignments []ast.Alignment
for _, col := range cols {
if tableDelimLeft.Match(col) {
if alignments == nil {
alignments = []ast.Alignment{}
}
alignments = append(alignments, ast.AlignLeft)
} else if tableDelimRight.Match(col) {
if alignments == nil {
alignments = []ast.Alignment{}
}
alignments = append(alignments, ast.AlignRight)
} else if tableDelimCenter.Match(col) {
if alignments == nil {
alignments = []ast.Alignment{}
}
alignments = append(alignments, ast.AlignCenter)
} else if tableDelimNone.Match(col) {
if alignments == nil {
alignments = []ast.Alignment{}
}
alignments = append(alignments, ast.AlignNone)
} else {
return nil