From 5413a2f962aed7c602902ea7f4802b0e721c1551 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 15 Jun 2020 10:33:17 +0200 Subject: Var naming --- docs/dev/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/dev/README.md b/docs/dev/README.md index 1ce8666e3..2e4a45998 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md @@ -236,6 +236,13 @@ struct Foo { } ``` +## Variable Naming + +We generally use boring and long names for local variables ([yay code completion](https://github.com/rust-analyzer/rust-analyzer/pull/4162#discussion_r417130973)). +The default name is lowercased named of the type: `global_state: GlobalState`. +Avoid ad-hoc acronyms and contractions, but use the ones that exist consistently (`db`, `ctx`, `acc`). +The default name for "result of the function" local variable is `res`. + ## Preconditions Function preconditions should generally be expressed in types and provided by the caller (rather than checked by callee): -- cgit v1.2.3