Skip to content

Fix all clippy warnings#65

Open
mcroomp wants to merge 1 commit intomainfrom
fix/clippy-warnings
Open

Fix all clippy warnings#65
mcroomp wants to merge 1 commit intomainfrom
fix/clippy-warnings

Conversation

@mcroomp
Copy link
Copy Markdown
Collaborator

@mcroomp mcroomp commented Apr 25, 2026

Summary

  • needless_range_loop: converted index-based for i in 0..len loops to idiomatic iterator/enumerate() patterns across ~12 sites
  • large_enum_variant: boxed PreflateStreamProcessor in FoundStreamType::DeflateStream, FindStreamResult::Found, and ChunkParseState::DeflateContinue to reduce enum stack sizes (was ~304–392 bytes)
  • upper_case_acronyms: renamed RGBRgb, RGBARgba in PngColorType; IHDRIhdr, IDATIdat, JPEGJpeg in the private Signature enum
  • missing_safety_doc: added # Safety sections to all 7 unsafe extern "C" functions in the DLL crate
  • manual_clamp / manual_memcpy / same_item_push: replaced with .clamp(), copy_from_slice, and repeat_n
  • ptr_arg: pqdownheap now takes &mut [HuffTreeNode] instead of &mut Vec<HuffTreeNode>
  • len_without_is_empty: added PlainText::is_empty() method
  • Various: needless_borrow, redundant_field_names, collapsible_if, useless_conversion, unnecessary_cast, needless_return, assign_op_pattern, etc.

All tests pass (cargo test --all), zero clippy warnings remain (cargo clippy --all).

Test plan

  • cargo clippy --all — zero warnings
  • cargo test --all — all tests pass

🤖 Generated with Claude Code

- needless_range_loop: convert index loops to iterator/enumerate patterns
- manual_clamp: replace min/max chains with .clamp()
- ptr_arg: accept &mut [T] instead of &mut Vec<T> where possible
- large_enum_variant: box large PreflateStreamProcessor in FoundStreamType,
  FindStreamResult, and ChunkParseState to reduce enum size
- upper_case_acronyms: rename RGB→Rgb, RGBA→Rgba, IHDR→Ihdr, IDAT→Idat,
  JPEG→Jpeg in private/public enums
- manual_memcpy: use copy_from_slice
- same_item_push: use repeat_n
- len_without_is_empty: add is_empty to PlainText
- too_many_arguments: suppress with allow attribute (refactoring would break API)
- missing_safety_doc: add Safety sections to all unsafe extern C functions
- Various: needless_borrow, redundant_field_names, collapsible_if,
  unnecessary_cast, needless_return, useless_conversion, etc.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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