Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rule: prefer-type-annotations #203

Open
DonIsaac opened this issue Jan 16, 2025 · 0 comments
Open

rule: prefer-type-annotations #203

DonIsaac opened this issue Jan 16, 2025 · 0 comments
Labels
A-linter Area - linter and lint rules C-rule Category - Lint rule suggestion good first issue Good for newcomers

Comments

@DonIsaac
Copy link
Owner

Description

Prefer using type annotations for contextual types over @as where possible. Idea provided by Inspector Boat in Zig's discord server.

Examples

Examples of incorrect code for this rule

const foo = @as(T, @castBuiltin(bar)); 

Examples of correct code for this rule

const foo: T = @castBuiltin(bar)
@DonIsaac DonIsaac added A-linter Area - linter and lint rules C-rule Category - Lint rule suggestion good first issue Good for newcomers labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - linter and lint rules C-rule Category - Lint rule suggestion good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant