◐ Shell
clean mode source ↗

Implement `Clone` for `ToTitlecase` iterator by ginnyTheCat · Pull Request #4 · RustPython/unicode-casing

Walkthrough

The pull request adds Clone derivation to two iterator-related types in the crate: CaseMappingIter with two new variants (One, Zero), and ToTitlecase wrapper struct, enabling both internal and public iterator types to be cloned.

Changes

Cohort / File(s) Summary
Iterator cloneability
src/lib.rs
Added #[derive(Clone)] to CaseMappingIter with new variants One and Zero for shorter or empty mapping sequences; added #[derive(Clone)] to public ToTitlecase wrapper struct

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify that the new One and Zero variants are properly integrated into existing pattern matching or enum handling logic
  • Confirm that all fields in both types are actually cloneable (no interior mutability or non-Clone dependencies)
  • Check that adding Clone doesn't introduce unintended copies or performance regressions in hot paths

Poem

A rabbit hops with glee, clone, clone, clone
Now iterators dance, no longer alone!
With One and with Zero, the mapping takes flight,
ToTitlecase copies itself, oh what a delight! 🐰✨

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Implement Clone for ToTitlecase iterator' accurately describes the main change in the changeset. The PR introduces #[derive(Clone)] for the ToTitlecase struct (the public iterator wrapper) and adds necessary variants to CaseMappingIter to support cloneability. The title is concise, specific, and clearly communicates the primary objective without unnecessary noise or vague terms.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.