You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 empty impl block with impl 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 empty impl block with impl Summary for NewsArticle {}, unless there's an existing impl block already.
The text was updated successfully, but these errors were encountered:
This is actually covered implicitly just a little ways below, starting at the paragraph which begins “Creating a default implementation doesn’t require us to change anything…” In that section, you will see an impl block for a non-default method which is for the trait. I can imagine ways we could make that more explicit, but I think the text does in fact already cover it. The key is one of sequencing for introducing those ideas, and any sequence we pick will confuse someone. 😉 In any case, I am glad you worked it out!
I have searched open and closed issues and pull requests for duplicates, using these search terms:
I have checked the latest
main
branch to see if this has already been fixed, in this file: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.
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:
The text was updated successfully, but these errors were encountered: