Free default() forwarding to Default::default()

When creating default values a trait method needs to be called with an
explicit trait name.  `Default::default()` seems redundant.  A free
function on the other hand, when imported directly, seems to be a better
API, as it is just `default()`.  When implementing the trait, a method
is still required.
This commit is contained in:
Ilya Bobyr 2020-06-03 20:36:53 -07:00
parent 450abe80f1
commit 8f4dfa8839
2 changed files with 54 additions and 1 deletions

View file

@ -14,7 +14,16 @@ error[E0425]: cannot find function `default` in this scope
--> $DIR/issue-2356.rs:31:5
|
LL | default();
| ^^^^^^^ help: try: `Self::default`
| ^^^^^^^
|
help: try
|
LL | Self::default();
| ^^^^^^^^^^^^^
help: consider importing this function
|
LL | use std::default::default;
|
error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:39:5