Skip to main content

case-convention

Style

What This Rule Does​

Enforces Zig's naming convention.

warning

Only functions are checked at this time.

Functions​

In general, functions that return values should use camelCase names while those that return types should use PascalCase. Specially coming from Rust, some people may be used to use snake_case for their functions, which can lead to inconsistencies in the code.

Note that extern functions are not checked since you cannot change their names.

Examples​

Examples of incorrect code for this rule:

fn this_one_is_in_snake_case() void {}
fn generic(T: type) T { return T{}; }

Examples of correct code for this rule:

fn thisFunctionIsInCamelCase() void {}
fn Generic(T: type) T { return T{}; }
extern fn this_is_declared_in_c() void;

Configuration​

This rule has no configuration.