Skip to content

Remove redundant casts - #567

Open
FranciscoTGouveia wants to merge 1 commit into
tikv:masterfrom
FranciscoTGouveia:remove-casts
Open

Remove redundant casts#567
FranciscoTGouveia wants to merge 1 commit into
tikv:masterfrom
FranciscoTGouveia:remove-casts

Conversation

@FranciscoTGouveia

@FranciscoTGouveia FranciscoTGouveia commented Aug 6, 2026

Copy link
Copy Markdown

If I am not overlooking anything, I believe these casts are redundant and can thus be safely removed.

For reference, this change was found by an optimizer developed as a research project.

CC @nunoplopes

Summary by CodeRabbit

  • Refactor
    • Simplified internal metric vector construction for counters, gauges, and histograms.
    • Preserved existing behavior and error handling.

@ti-chi-bot

ti-chi-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

Welcome @FranciscoTGouveia! It looks like this is your first PR to tikv/rust-prometheus 🎉

@ti-chi-bot

ti-chi-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

Thanks for your pull request. Before we can look at it, you'll need to add a 'DCO signoff' to your commits.

📝 Please follow instructions in the contributing guide to update your commits with the DCO

Full details of the Developer Certificate of Origin can be found at developercertificate.org.

The list of commits missing DCO signoff:

  • 27b281a chore: remove redundant casts
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e40646b-c723-4201-b03c-2dc6d11d3943

📥 Commits

Reviewing files that changed from the base of the PR and between 8151418 and 27b281a.

📒 Files selected for processing (3)
  • src/counter.rs
  • src/gauge.rs
  • src/histogram.rs

📝 Walkthrough

Walkthrough

The constructors for counter, gauge, and histogram vectors now return metric_vec directly. The redundant explicit casts were removed. Behavior and error handling remain unchanged.

Changes

Metric vector constructor returns

Layer / File(s) Summary
Direct constructor returns
src/counter.rs, src/gauge.rs, src/histogram.rs
GenericCounterVec::new, GenericGaugeVec::new, and HistogramVec::new return the created metric vector without an explicit cast.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the removal of redundant casts in the changed constructors.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@FranciscoTGouveia

Copy link
Copy Markdown
Author

I have tried to find the CONTRIBUTING.md file (both before sending the patch and after the bot's suggestion), but to no avail.
Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant