Skip to content

Commit 5413a2f

Browse files
committed
Var naming
1 parent 017331a commit 5413a2f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/dev/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,13 @@ struct Foo {
236236
}
237237
```
238238

239+
## Variable Naming
240+
241+
We generally use boring and long names for local variables ([yay code completion](https://github.com/rust-analyzer/rust-analyzer/pull/4162#discussion_r417130973)).
242+
The default name is lowercased named of the type: `global_state: GlobalState`.
243+
Avoid ad-hoc acronyms and contractions, but use the ones that exist consistently (`db`, `ctx`, `acc`).
244+
The default name for "result of the function" local variable is `res`.
245+
239246
## Preconditions
240247

241248
Function preconditions should generally be expressed in types and provided by the caller (rather than checked by callee):

0 commit comments

Comments
 (0)