Skip to content

docs(code): add Principle of Least Surprise guideline#1906

Merged
LNSD merged 1 commit intomainfrom
lnsd/docs-code-principle-least-surprise
Mar 4, 2026
Merged

docs(code): add Principle of Least Surprise guideline#1906
LNSD merged 1 commit intomainfrom
lnsd/docs-code-principle-least-surprise

Conversation

@LNSD
Copy link
Contributor

@LNSD LNSD commented Mar 4, 2026

Codify idiomatic Rust naming and trait conventions as a mandatory principle anchored on std library patterns.

  • Cover constructors (new, From/TryFrom), parsing (FromStr), and access prefixes (as_/to_/into_)
  • Define is_/has_ boolean contract and hidden side-effect prohibition
  • Include 5 Bad/Good example pairs with project-relevant types
  • Cross-reference type-driven-design and validate-at-edge principles

Codify idiomatic Rust naming and trait conventions as a mandatory principle anchored on std library patterns.

- Cover constructors (`new`, `From`/`TryFrom`), parsing (`FromStr`), and access prefixes (`as_`/`to_`/`into_`)
- Define `is_`/`has_` boolean contract and hidden side-effect prohibition
- Include 5 Bad/Good example pairs with project-relevant types
- Cross-reference type-driven-design and validate-at-edge principles

Signed-off-by: Lorenzo Delgado <lorenzo@edgeandnode.com>
@LNSD LNSD requested review from mitchhs12 and shiyasmohd March 4, 2026 12:54
@LNSD LNSD self-assigned this Mar 4, 2026
@LNSD LNSD added documentation Improvements or additions to documentation workflow labels Mar 4, 2026
@LNSD LNSD merged commit 2177875 into main Mar 4, 2026
24 of 29 checks passed
@LNSD LNSD deleted the lnsd/docs-code-principle-least-surprise branch March 4, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants