Skip to content

Commit 2810ad8

Browse files
committed
chore: statements exhaustiveness
1 parent 1095088 commit 2810ad8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

shorten/format.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,21 @@ func (s *Shortener) formatStmt(stmt dst.Stmt, force bool) {
145145
case *dst.SwitchStmt:
146146
s.formatStmt(st.Body, false)
147147

148+
case *dst.BadStmt, *dst.EmptyStmt, *dst.LabeledStmt,
149+
*dst.SendStmt, *dst.IncDecStmt, *dst.BranchStmt, *dst.TypeSwitchStmt:
150+
// These statements are explicitly defined to improve switch cases exhaustiveness.
151+
// They may be handled in the future.
152+
if shouldShorten {
153+
s.logger.Debug(
154+
"got a statement type that is not shortened",
155+
slog.Any("stmt_type", stmtType),
156+
)
157+
}
158+
148159
default:
149160
if shouldShorten {
150161
s.logger.Debug(
151-
"got a statement type that can't be shortened",
162+
"got an unknown statement type",
152163
slog.Any("stmt_type", stmtType),
153164
)
154165
}

0 commit comments

Comments
 (0)