diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2021-08-02 15:59:28 +0300 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2021-08-02 15:59:28 +0300 |
| commit | 12d7f5b56e23d2d62884e941fa81937ce8799960 (patch) | |
| tree | ac72ad4b24ccf3c513b32185919689ddc0640da1 /docs/dev | |
| parent | 5f3662e01ce7d5216b3dd7ce3095402af1d75c17 (diff) | |
| download | rust-12d7f5b56e23d2d62884e941fa81937ce8799960.tar.gz rust-12d7f5b56e23d2d62884e941fa81937ce8799960.zip | |
internal: explain that we don't `ref` in style.md
Diffstat (limited to 'docs/dev')
| -rw-r--r-- | docs/dev/style.md | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md index 6309fd02ce4..d5340e2b8e3 100644 --- a/docs/dev/style.md +++ b/docs/dev/style.md @@ -915,6 +915,15 @@ if let Some(expected_type) = ctx.expected_type.as_ref() { **Rationale:** `match` is almost always more compact. The `else` branch can get a more precise pattern: `None` or `Err(_)` instead of `_`. +## Match Ergonomics + +Don't use the `ref` keyword. + +**Rationale:** consistency & simplicity. +`ref` was required before [match ergonomics](https://github.com/rust-lang/rfcs/blob/master/text/2005-match-ergonomics.md). +Today, it is redundant. +Between `ref` and mach ergonomics, the latter is more ergonomic in most cases, and is simpler (does not require a keyword). + ## Helper Functions Avoid creating singe-use helper functions: |
