book
book copied to clipboard
Make it clear that default traits do not require a separate empty impl block in Section 10.2
-
I have searched open and closed issues and pull requests for duplicates, using these search terms:
- impl
- 10.2
- default
-
I have checked the latest
mainbranch to see if this has already been fixed, in this file:- src/ch10-02-traits.md
URL to the section(s) of the book with this problem: https://rust-book.cs.brown.edu/ch10-02-traits.html#default-implementations
Description of the problem: I think the sentence below could be worded better.
To use a default implementation to summarize instances of
NewsArticle, we specify an emptyimplblock withimpl Summary for NewsArticle {}.
It can be helpful to emphasize that a trait containing both default and non-implemented methods doesn't require two impl blocks, one of which is empty.
Suggested fix: The phrasing that could be used:
To use a default implementation to summarize instances of
NewsArticle, we must specify an emptyimplblock withimpl Summary for NewsArticle {}, unless there's an existingimplblock already.