aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/dev/README.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/dev/README.md b/docs/dev/README.md
index 1ce8666e3..4cb5dfaa0 100644
--- a/docs/dev/README.md
+++ b/docs/dev/README.md
@@ -236,6 +236,13 @@ struct Foo {
236} 236}
237``` 237```
238 238
239## Variable Naming
240
241We generally use boring and long names for local variables ([yay code completion](https://github.com/rust-analyzer/rust-analyzer/pull/4162#discussion_r417130973)).
242The default name is lowercased named of the type: `global_state: GlobalState`.
243Avoid ad-hoc acronyms and contractions, but use the ones that exist consistently (`db`, `ctx`, `acc`).
244The default name for "result of the function" local variable is `res`.
245
239## Preconditions 246## Preconditions
240 247
241Function preconditions should generally be expressed in types and provided by the caller (rather than checked by callee): 248Function preconditions should generally be expressed in types and provided by the caller (rather than checked by callee):
@@ -335,6 +342,12 @@ There are two kinds of tests:
335The purpose of inline tests is not to achieve full coverage by test cases, but to explain to the reader of the code what each particular `if` and `match` is responsible for. 342The purpose of inline tests is not to achieve full coverage by test cases, but to explain to the reader of the code what each particular `if` and `match` is responsible for.
336If you are tempted to add a large inline test, it might be a good idea to leave only the simplest example in place, and move the test to a manual `parser/ok` test. 343If you are tempted to add a large inline test, it might be a good idea to leave only the simplest example in place, and move the test to a manual `parser/ok` test.
337 344
345To update test data, run with `UPDATE_EXPECTATIONS` variable:
346
347```bash
348env UPDATE_EXPECTATIONS=1 cargo qt
349```
350
338# Logging 351# Logging
339 352
340Logging is done by both rust-analyzer and VS Code, so it might be tricky to 353Logging is done by both rust-analyzer and VS Code, so it might be tricky to