comprehensive-rust
comprehensive-rust copied to clipboard
Simplify error handling pages
This makes the use statements more consistent and shortens some variable names. When teaching the class last week, I noticed that the pages were too large to fit on the screen, so I hope this helps a tiny bit with this.
Doesn't using partially qualified names for types make the code samples longer and harder to read?
To me, it avoids front loading: the imports currently have a lot of details from the code below.
They're complex, with funny dances in the form of std::fs::{self, ..} — that statement is terrible in the way that it has two names for the same thing (std::fs and the temporary alias self). Importing std::fs and using fs afterwards is simpler: no need to explain the self alias.
In addition to making the import itself simpler, I like how related types and functions can be grouped by module.
I know it's not consistent, but some modules seem like they're designed to be imported this way. In particular, std::fs and std::io. A module that doesn't work that way for me is std:: collections.
Let's drop this, i have other cleanups for the same slides :smile: