about summary refs log tree commit diff
path: root/docs/dev
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-08-02 13:00:07 +0000
committerGitHub <noreply@github.com>2021-08-02 13:00:07 +0000
commit0d56ff2a02b5d490058f9ea2e6da8d9f44859c0b (patch)
tree2ff0abc5e29624ba33c96ded3f72735e832ce928 /docs/dev
parentd6f2352a084ad405f1380c7b9389aa8ddf326760 (diff)
parent12d7f5b56e23d2d62884e941fa81937ce8799960 (diff)
downloadrust-0d56ff2a02b5d490058f9ea2e6da8d9f44859c0b.tar.gz
rust-0d56ff2a02b5d490058f9ea2e6da8d9f44859c0b.zip
Merge #9758
9758: internal: explain that we don't `ref` in style.md r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Diffstat (limited to 'docs/dev')
-rw-r--r--docs/dev/style.md9
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: