Add use super::*;
to unit-test examples.
#3188
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
rust-lang/cargo#10706 switched the
cargo init --lib
-generated src/lib.rsto use a function and
use super::*;
inside themod test
. This makesit easier for new users to write their own functions and add tests, as it
means the tests can refer to the new functions without any extra work, and
without rustc asking them to add explicit
use
s for each new thing they add.This PR updates the parts of the book that use this src/lib.rs and
similar examples, to match the new output of
cargo init --lib
, and toadditionally help guide users to using
use super::*;
inside theirmod test
s.There is one non-example change, which is to update the wording in
src/ch11-01-writing-tests.md to better reflect the new content in the
associated example.