-
Notifications
You must be signed in to change notification settings - Fork 4k
refactor: to use std libary func bytes.CutPrefix #25361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughReplaced a custom prefix-stripping helper in PrefixIterator.Key with bytes.CutPrefix, adding an explicit presence check and panic on mismatch. Removed the unused helper. External behavior remains unchanged when the prefix is valid. Changes
Sequence Diagram(s)sequenceDiagram
participant C as Caller
participant PI as PrefixIterator
participant B as bytes.CutPrefix
C->>PI: Key()
PI->>B: CutPrefix(key, prefix)
B-->>PI: (rest, ok)
alt prefix present
PI-->>C: return rest
else prefix missing
PI-->>C: panic("should not happen")
end
note over PI: Explicit validation replaces implicit assumption
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Knowledge base: Disabled due to 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (2)
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. Comment |
can you test and benchmark this |
benchmark:
it's almost equal. code logic is almost equal too. |
Summary by CodeRabbit
No user-facing behavior changes are expected under normal conditions; overall robustness and maintainability are improved.