Skip to content

style: Satisfy clippy map_or and Duration unit lints - #11

Merged
joshuaclayton merged 1 commit into
mainfrom
fix/clippy-map-or-duration-units
Aug 27, 2026
Merged

style: Satisfy clippy map_or and Duration unit lints#11
joshuaclayton merged 1 commit into
mainfrom
fix/clippy-map-or-duration-units

Conversation

@joshuaclayton

Copy link
Copy Markdown
Owner

clippy 0.1.97 promotes two lints that fail -D warnings across the crate (independent of any feature change — main is red on them too):

  • map(f).unwrap_or(a) on a Resultmap_or(a, f) (3 sites)
  • constructing a Duration from 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 Duration keeps 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)); the map_or calls are semantically identical. No behavior change.

cargo clippy --workspace --examples --tests --features testing -- -D warnings clean; full suite passes (168 tests, --features testing).

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
joshuaclayton force-pushed the fix/clippy-map-or-duration-units branch from cd5ee5f to d8e65e4 Compare August 27, 2026 22:07
@joshuaclayton
joshuaclayton merged commit 1f1c9c4 into main Aug 27, 2026
7 of 8 checks passed
@joshuaclayton
joshuaclayton deleted the fix/clippy-map-or-duration-units branch August 27, 2026 22:16
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.

1 participant