Fix most of `clippy::pedantic`
Part of #7 (closed).
This MR has fixed many of the clippy::pedantic lints, in alphabetical order.
Due to the huge refactor involved in the latest commit (49a917ba), the clippy::pedantic lints will be fixed in multiple MRs.
There are no interesting commits, just a lot of code being moved around.