Skip to content

Commit b9326ca

Browse files
committed
auto merge of #16653 : steveklabnik/rust/module_wording, r=alexcrichton
@Kimundi was a bit worried this was misleading.
2 parents 19a44c7 + f675992 commit b9326ca

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/doc/guide.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -2896,9 +2896,11 @@ pub fn print_hello() {
28962896
}
28972897
```
28982898

2899-
When we include a module like this, we don't need to make the `mod` declaration,
2900-
it's just understood. This helps prevent 'rightward drift': when you end up
2901-
indenting so many times that your code is hard to read.
2899+
When we include a module like this, we don't need to make the `mod` declaration
2900+
in `hello.rs`, because it's already been declared in `lib.rs`. `hello.rs` just
2901+
contains the body of the module which is defined (by the `pub mod hello`) in
2902+
`lib.rs`. This helps prevent 'rightward drift': when you end up indenting so
2903+
many times that your code is hard to read.
29022904

29032905
Finally, make a new directory, `src/goodbye`, and make a new file in it,
29042906
`src/goodbye/mod.rs`:

0 commit comments

Comments
 (0)