File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
internal/rules/prefer_reduce_type_parameter Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -59,16 +59,18 @@ var PreferReduceTypeParameterRule = rule.Rule{
5959 return
6060 }
6161
62- fixes := make ([]rule.RuleFix , 0 , 2 )
63- if secondArg .Kind == ast .KindAsExpression {
64- fixes = append (fixes , rule .RuleFixRemoveRange (assertionType .Loc .WithPos (assertionExpr .End ())))
65- } else {
66- fixes = append (fixes , rule .RuleFixRemoveRange (secondArg .Loc .WithEnd (assertionExpr .Pos ())))
67- }
68- if expr .TypeArguments == nil {
69- fixes = append (fixes , rule .RuleFixInsertAfter (callee , "<" + ctx .SourceFile .Text ()[assertionType .Pos ():assertionType .End ()]+ ">" ))
70- }
71- ctx .ReportNodeWithFixes (secondArg , buildPreferTypeParameterMessage (), func () []rule.RuleFix { return fixes })
62+ ctx .ReportNodeWithFixes (secondArg , buildPreferTypeParameterMessage (), func () []rule.RuleFix {
63+ fixes := make ([]rule.RuleFix , 0 , 2 )
64+ if secondArg .Kind == ast .KindAsExpression {
65+ fixes = append (fixes , rule .RuleFixRemoveRange (assertionType .Loc .WithPos (assertionExpr .End ())))
66+ } else {
67+ fixes = append (fixes , rule .RuleFixRemoveRange (secondArg .Loc .WithEnd (assertionExpr .Pos ())))
68+ }
69+ if expr .TypeArguments == nil {
70+ fixes = append (fixes , rule .RuleFixInsertAfter (callee , "<" + ctx .SourceFile .Text ()[assertionType .Pos ():assertionType .End ()]+ ">" ))
71+ }
72+ return fixes
73+ })
7274 },
7375 }
7476 },
You can’t perform that action at this time.
0 commit comments