comprehensive-rust icon indicating copy to clipboard operation
comprehensive-rust copied to clipboard

Simplify error handling pages

Open mgeisler opened this issue 2 years ago • 2 comments

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.

mgeisler avatar Jan 31 '23 19:01 mgeisler

Doesn't using partially qualified names for types make the code samples longer and harder to read?

qwandor avatar Feb 01 '23 14:02 qwandor

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.

mgeisler avatar Feb 09 '23 06:02 mgeisler

Let's drop this, i have other cleanups for the same slides :smile:

mgeisler avatar Apr 27 '23 16:04 mgeisler