Skip to content

refactor: simplify patterns in sorted_map, sorted_set, and queue#3314

Open
bobzhang wants to merge 1 commit intomainfrom
hongbo/simplify-patterns
Open

refactor: simplify patterns in sorted_map, sorted_set, and queue#3314
bobzhang wants to merge 1 commit intomainfrom
hongbo/simplify-patterns

Conversation

@bobzhang
Copy link
Contributor

@bobzhang bobzhang commented Mar 19, 2026

Summary

  • sorted_map: Simplify contains to use self.get(key) is Some(_) instead of a full match expression
  • sorted_set: Replace mutable accumulator + each pattern with iter().all() in subset and disjoint
  • queue: Simplify peek to use self.first.map(first => first.content) instead of explicit match

Test plan

  • All 68 sorted_map tests pass
  • All 48 sorted_set tests pass
  • All 60 queue tests pass

🤖 Generated with Claude Code

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@bobzhang bobzhang force-pushed the hongbo/simplify-patterns branch from 37287d0 to ff6f67d Compare March 19, 2026 14:31
@coveralls
Copy link
Collaborator

coveralls commented Mar 19, 2026

Pull Request Test Coverage Report for Build 3063

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.002%) to 95.767%

Totals Coverage Status
Change from base Build 3061: -0.002%
Covered Lines: 13756
Relevant Lines: 14364

💛 - Coveralls

@bobzhang bobzhang changed the title refactor: simplify sorted_map contains and sorted_set subset/disjoint refactor: simplify patterns in sorted_map, sorted_set, and queue Mar 19, 2026
sorted_map: use `is Some(_)` instead of match for contains
sorted_set: use `iter().all()` instead of mutable accumulator
  with each callback for subset and disjoint

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bobzhang bobzhang force-pushed the hongbo/simplify-patterns branch from ff6f67d to 378fd68 Compare March 19, 2026 14:48
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.

2 participants