mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
Add default names section
This commit is contained in:
parent
e01cfe2b45
commit
0d201638d9
@ -148,8 +148,13 @@ struct Foo {
|
||||
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 a lowercased name 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`.
|
||||
The default name for "I don't really care about the name" variable is `it`.
|
||||
|
||||
Default names:
|
||||
|
||||
* `res` -- "result of the function" local variable
|
||||
* `it` -- I don't really care about the name
|
||||
* `n_foo` -- number of foos
|
||||
* `foo_idx` -- index of `foo`
|
||||
|
||||
# Collection types
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user