style: Satisfy clippy map_or and Duration unit lints - #11
Merged
Conversation
clippy 0.1.97 promotes two lints across the crate: map(f).unwrap_or(a) on Result (use map_or), and constructing a Duration from a smaller unit where a larger one reads better (from_secs(3600) -> from_hours(1)). Mechanical rewrites only — every Duration keeps its exact value and the map_or calls are semantically identical. No behavior change; full suite passes (168 tests, --features testing).
joshuaclayton
force-pushed
the
fix/clippy-map-or-duration-units
branch
from
August 27, 2026 22:07
cd5ee5f to
d8e65e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
clippy0.1.97 promotes two lints that fail-D warningsacross the crate (independent of any feature change —mainis red on them too):map(f).unwrap_or(a)on aResult→map_or(a, f)(3 sites)Durationfrom a smaller unit where a larger one reads better, e.g.Duration::from_secs(3600)→Duration::from_hours(1)(~24 sites)Mechanical rewrites only. Every
Durationkeeps its exact value (from_secs(60)→from_mins(1),from_secs(3600)→from_hours(1),from_secs(7200)→from_hours(2),from_secs(300)→from_mins(5)); themap_orcalls are semantically identical. No behavior change.cargo clippy --workspace --examples --tests --features testing -- -D warningsclean; full suite passes (168 tests,--features testing).