Skip to content

Replace literal conditions with nilable casts#15844

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
straight-shoota:spec/literal-condition
May 30, 2025
Merged

Replace literal conditions with nilable casts#15844
straight-shoota merged 1 commit intocrystal-lang:masterfrom
straight-shoota:spec/literal-condition

Conversation

@straight-shoota
Copy link
Member

The conditional is just a mechanism to introduce a nilable type. Using an explicit cast is better.

This was discovered with ameba's Lint/LiteralInCondition rule.

@straight-shoota straight-shoota added this to the 1.17.0 milestone May 28, 2025
@straight-shoota straight-shoota merged commit d0866a4 into crystal-lang:master May 30, 2025
39 checks passed
@straight-shoota straight-shoota deleted the spec/literal-condition branch May 30, 2025 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants