doc: forward-port the conditions tutorial + fixup libstd example#10986
Conversation
There was a problem hiding this comment.
Hm, if we can avoid an allocation, then why encourage an allocation in the code example? Why not replace the example above with this code?
There was a problem hiding this comment.
I thought that having more generic code would be good for the tutorial. Do you want me to swap it?
There was a problem hiding this comment.
It doesn't make sense to me to have two versions of code where you say "this one is better" but you showcase the other one. This suggestion about avoiding allocations should either be dropped or integrated into the other examples in my opinion.
|
Nice work, thanks! |
There was a problem hiding this comment.
Isn't the whole point of this section to showcase failure? Why remove the one comment pointing it out that this is the error-handling strategy used in this case?
There was a problem hiding this comment.
@alexcrichton Legitimate failure here: the bots want a file with its path path passed as args to test... can I simulate the above with the actual implementation or should I keep the tests xfailed?
There was a problem hiding this comment.
I think we've seen what happens when the tests get xfailed, so let's keep them not-xfailed if at all possible. You can take the route of the above code (give a dummy reader) if you want by having mod File hidden at the top.
Thanks to @huonw for some mentoring. 🍰
…=Manishearth Allow safety comment above attributes Closes rust-lang#8679 changelog: Enhancement: [`undocumented_safety_block`]: Added `accept-comment-above-attributes` configuration.
Thanks to @huonw for some mentoring. 🍰