diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2021-07-12 20:14:58 +0300 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2021-07-12 20:18:07 +0300 |
| commit | a9d0d1414a8d137d6abda1287cb7ec8b397aa54d (patch) | |
| tree | 9724e583b24d9e9d27f953ea6f8c3358c7da6823 /docs/dev | |
| parent | 67a7dfda43c29b21ed1a5155a57d3a04f553d247 (diff) | |
| download | rust-a9d0d1414a8d137d6abda1287cb7ec8b397aa54d.tar.gz rust-a9d0d1414a8d137d6abda1287cb7ec8b397aa54d.zip | |
internal: remove erroneous default impl
Diffstat (limited to 'docs/dev')
| -rw-r--r-- | docs/dev/style.md | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md index 696a175a847..7e8e41a4178 100644 --- a/docs/dev/style.md +++ b/docs/dev/style.md @@ -312,7 +312,7 @@ Even when generality is not required, consistency is important. ## Constructors -Prefer `Default` to zero-argument `new` function +Prefer `Default` to zero-argument `new` function. ```rust // GOOD @@ -341,6 +341,10 @@ Use `Vec::new` rather than `vec![]`. **Rationale:** uniformity, strength reduction. +Avoid using "dummy" states to implement a `Default`. +If a type doesn't have a sensible default, empty value, don't hide it. +Let the caller explicitly decide what's the right initial state is. + ## Functions Over Objects Avoid creating "doer" objects. |
