@@ -536,6 +536,12 @@ The most important common traits to implement from `std` are:
536
536
- [ ` Display ` ] ( https://doc.rust-lang.org/std/fmt/trait.Display.html )
537
537
- [ ` Default ` ] ( https://doc.rust-lang.org/std/default/trait.Default.html )
538
538
539
+ Note that it is common and expected for types to implement both
540
+ ` Default ` and an empty ` new ` constructor. ` new ` is the constructor
541
+ convention in Rust, and users expect it to exist, so if it is
542
+ reasonable for the basic constructor to take no arguments, then it
543
+ should, even if it is functionally identical to ` default ` .
544
+
539
545
[ C-CONV-TRAITS ] : #c-conv-traits
540
546
<a id =" c-conv-traits " ></a >
541
547
### Conversions use the standard traits ` From ` , ` AsRef ` , ` AsMut ` (C-CONV-TRAITS)
@@ -1338,6 +1344,11 @@ let config = Config { color: Red, .. Config::new() };
1338
1344
[ `std::io::Error::new` ] : https://doc.rust-lang.org/std/io/struct.Error.html#method.new
1339
1345
[ `std::io::Error::from_raw_os_error` ] : https://doc.rust-lang.org/std/io/struct.Error.html#method.from_raw_os_error
1340
1346
1347
+ Note that it is common and expected for types to implement both
1348
+ ` Default ` and an empty ` new ` constructor. ` new ` is the constructor
1349
+ convention in Rust, and users expect it to exist, so if it is
1350
+ reasonable for the basic constructor to take no arguments, then it
1351
+ should, even if it is functionally identical to ` default ` .
1341
1352
1342
1353
<a id =" flexibility " ></a >
1343
1354
## Flexibility
0 commit comments