Skip to content

Commit 4184b1b

Browse files
committed
New and default should have the same behavior
1 parent 4734186 commit 4184b1b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/predictability.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,9 @@ trait ([C-CONV-TRAITS]), which is quite similar. Guidelines for
201201
writing a `From` implementation vs. writing `from_foo` need further
202202
examination.
203203

204-
Note that it is common and expected for types to implement both
205-
`Default` and a `new` constructor. `new` is the constructor
206-
convention in Rust, and users expect it to exist, so if it is
207-
reasonable for the basic constructor to take no arguments, then it
208-
should, even if it is functionally identical to `default`.
204+
Note that it is common and expected for types to implement both `Default` and a
205+
`new` constructor. For types that have both, they should have the same behavior.
206+
Either one may be implemented in terms of the other.
209207

210208
[C-BUILDER]: type-safety.html#c-builder
211209
[C-CONV-TRAITS]: interoperability.html#c-conv-traits

0 commit comments

Comments
 (0)