Skip to content

Commit

Permalink
mdbook fix-up
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmcsherry committed Nov 10, 2024
1 parent d9cff68 commit fb23fdc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions mdbook/src/chapter_2/chapter_2_4.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ fn main() {
while let Some((time, data)) = input1.next() {
stash.entry(time.time().clone())
.or_insert(Vec::new())
.push(data.replace(Vec::new()));
.push(std::mem::take(data));
notificator.notify_at(time.retain());
}
while let Some((time, data)) = input2.next() {
stash.entry(time.time().clone())
.or_insert(Vec::new())
.push(data.replace(Vec::new()));
.push(std::mem::take(data));
notificator.notify_at(time.retain());
}

Expand Down Expand Up @@ -242,12 +242,12 @@ fn main() {
while let Some((time, data)) = input1.next() {
stash.entry(time.retain())
.or_insert(Vec::new())
.push(data.replace(Vec::new()));
.push(std::mem::take(data));
}
while let Some((time, data)) = input2.next() {
stash.entry(time.retain())
.or_insert(Vec::new())
.push(data.replace(Vec::new()));
.push(std::mem::take(data));
}

// consider sending everything in `stash`.
Expand Down
4 changes: 2 additions & 2 deletions mdbook/src/chapter_2/chapter_2_5.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ As before, I'm just going to show you the new code, which now lives just after `
while let Some((time, data)) = input.next() {
queues.entry(time.retain())
.or_insert(Vec::new())
.extend(data.replace(Vec::new()));
.extend(std::mem::take(data));
}

// enable each stashed time if ready.
Expand Down Expand Up @@ -297,7 +297,7 @@ Inside the closure, we do two things: (i) read inputs and (ii) update counts and
while let Some((time, data)) = input.next() {
queues.entry(time.retain())
.or_insert(Vec::new())
.extend(data.replace(Vec::new()));
.extend(std::mem::take(data));
}
```

Expand Down

0 comments on commit fb23fdc

Please sign in to comment.