tokio-rs / loom

Concurrency permutation testing tool for Rust.
MIT License
2.09k stars 110 forks source link

fix a bunch of annoying clippy lints #239

Closed hawkw closed 2 years ago

hawkw commented 2 years ago

This branch fixes a big pile of clippy lints. These are mostly not particularly important, but they were kinda bugging me, so I thought it was nice to fix them.

I've tried to separate out each individual lint category into separate commits, with notes in the commit message as necessary. Most of these changes are completely trivial, but there are a few that might be worth actually reviewing in detail. Therefore, each commit can be considered individually, and if there are any cases where we don't like Clippy's suggestions, I can back out those commits and add #[allow(...)] attributes instead.

In particular, clippy suggested adding Default implementations for a few types. This seems pretty harmless, but (unlike the rest of this PR) it is an actual API change, so if that's unwanted, I can back out that commit and add allow attributes for the new_without_default lint, instead.

I've also added some new documentation to resolve the clippy::missing_safety_doc lint. In most cases, this was on functions that mimic std APIs that are unsafe, so I've copied the # Safety sections from the std docs for those functions. In some cases I've added additional text to the documentation describing differences between loom's version and std's versions of these functions.

hawkw commented 2 years ago

cc @carllerche any concerns about the API additions, or shall i just go ahead and merge this?