Skip to content

Conversation

@mgeisler
Copy link
Collaborator

When reading the code without an IDE, I find it useful to use explicit
module names, especially when items come from the standard library.

So io::Error instead of just Error, especially when people have
just been told about std::error::Error as well.

I also omitted most single-use items: I find it has less cognitive
overhead to say “we import fmt” and then later use fmt::Display
and fmt::Formatter in the code. It’s clear from the name that these
two things have something to do with formatting.

Finally, I made a few usages more consistent so that we refer to each
item in the same way within a single codeblock.

When reading the code without an IDE, I find it useful to use explicit
module names, especially when items come from the standard library.

So `io::Error` instead of just `Error`, especially when people have
just been told about `std::error::Error` as well.

I also omitted most single-use items: I find it has less cognitive
overhead to say “we import `fmt`” and then later use `fmt::Display`
and `fmt::Formatter` in the code. It’s clear from the name that these
two things have something to do with formatting.

Finally, I made a few usages more consistent so that we refer to each
item in the same way within a single codeblock.
@mgeisler mgeisler requested a review from djmitche October 28, 2024 18:46
@mgeisler mgeisler merged commit 1d7c916 into main Oct 29, 2024
37 checks passed
@mgeisler mgeisler deleted the simplify-imports branch October 29, 2024 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants