Part of #2478 to clean up code blocks when all that is needed is a
trivial debug print statement.
As mentioned in previous related PRs, in some places I've opted to
retain the use of println! because dbg! makes it less readable.
Co-authored-by: Eric Githinji <egithinji@google.com>
Use chopstick to explain why 2 are needed to eat.
Limit async to 2 philosophers so they can deadlock in tokio.
(Tested with [3, 4, 5] philosophers and they all were able to run
without deadlock
with lock ordering disabled.)
---------
Co-authored-by: Sterling Stein <scubed2+git@gmail.com>
Part of #2478 to clean up code blocks when all that is needed is a
trivial debug print statement.
In certain slides (8.1, 9.2, 9.3, 10.5) I've opted to retain the use of
println! because dbg! makes it less readable. The
dbg! macro uses pretty-printing by default and this results in a simple
array such as the one in 8.1 being printed vertically instead of a
cleaner one-liner.
Co-authored-by: Eric Githinji <egithinji@google.com>
As mentioned in #2478, this cleans up the code blocks when all that is
needed is a trivial debug print statement.
Only making changes to Day 1 morning session so that I can get feedback
before proceeding with the rest of the course.
---------
Co-authored-by: Eric Githinji <egithinji@google.com>
This is more idiomatic than what we had before.
We keep the trait bounds for the inherent impl, because the new method
can use them to guide inference of unannotated closure arguments.
The content slides all use `fn main`, with the exception of the testing
segment. But with this change, where it makes sense exercises use tests
instead, and not both tests and `fn main`.
A small change in `book.js` supports running tests when a code sample
does not have `fn main` but does have `#[test]`, so these work
naturally.
Fixes#1581.
The speaker notes on the borrowck slide are a bit hard to read since
it's a big block of bulleted points. I've reorganized the notes to be a
bit easier to read by making some of the bullet points nested and by
moving some of the points to the "More to Explore" section. I've also
added a note on re-borrowing since students sometimes ask about it, and
I've added some playground links to demonstrate some of the points.