Skip to content

Commit 2e96aa9

Browse files
committed
Update RULES.md
1 parent a4b46ed commit 2e96aa9

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

RULES.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,15 @@ The goal of the rule is to keep error contracts clear and stable. If it can fail
583583

584584
## `no_literal_args`
585585

586-
Disallow passing primitive literal numbers and booleans directly as function arguments.
586+
Disallow passing primitive literal numbers and booleans directly as
587+
function arguments.
587588

588-
Passing literal `1`, `0`, `true`, or `false` directly to a function is ambiguous.
589+
Passing literal `1`, `0`, `true`, or `false` directly to a function is
590+
ambiguous.
589591

590-
These magic literals don’t explain what they mean. Consider using named constants or if you're the owner of the API and there's multiple arguments, consider introducing a struct argument
592+
These magic literals don’t explain what they mean. Consider using named
593+
constants or if you're the owner of the API and there's multiple arguments,
594+
consider introducing a struct argument
591595

592596
**Config options:**
593597

@@ -857,19 +861,17 @@ Enforces that container declarations are referenced.
857861

858862
## `require_braces`
859863

860-
> [!WARNING]
861-
> The `require_braces` rule is still under testing and development. It may
862-
> not work as expected and may change without notice.
863-
864864
Requires specific brace `{}` usage for the bodies of `if`, `else`, `while`,
865865
`for`, `defer` and `catch` statements.
866866

867-
By requiring braces, you avoid ambiguity, make code easier to maintain,
868-
and prevent unintended logic changes when adding new lines.
867+
By requiring braces, you're consistent and avoid ambiguity, which can code
868+
easier to maintain, and prevent unintended logic changes when adding new
869+
lines.
869870

870871
If an `if` statement is used as part of a return or assignment it is excluded
871-
from this rule (braces not required). For example, the following two examples
872-
will be ignored by this rule.
872+
from this rule (braces not required).
873+
874+
For example, the following two examples will be ignored by this rule.
873875

874876
```zig
875877
const label = if (x > 10) "over 10" else "under 10";
@@ -975,9 +977,7 @@ in these cases can lead to memory leaks.
975977
**Caveats:**
976978

977979
* This rule is not exhaustive. It makes a best-effort attempt to detect known
978-
object declarations that require cleanup, but a complete check is
979-
impractical at this level. It currently only looks at std library containers
980-
like `ArrayList` and `HashMap`.
980+
object declarations that require cleanup.
981981

982982
* This rule cannot always reliably detect usage of fixed buffer allocators or
983983
arenas; however, using `errdefer array.deinit(arena);` in these cases is

0 commit comments

Comments
 (0)