Repository navigation
perf(plugin): Fix rust-skills CRITICAL and HIGH issues - #762
Merged
Merged
Conversation
rust-skills: opt-inline-hints, mem-vec-with-capacity, err-no-unwrap-prod Applied rust-skills review recommendations: 1. native/mod.rs:36 - Add #[inline] to plugin_short_name() - Hot function called during plugin lookup - Improves performance for frequent name matching 2. runtime.rs:266 - Vec::with_capacity(self.plugins.len()) - Pre-allocate errors Vec in execute_all() - Saves 1 alloc per plugin execution batch 3. runtime.rs:364 - Add comment for unwrap_or_else - Clarifies why canonicalize failure is acceptable - Handles symlink issues gracefully Tests: Plugin crate compiles successfully.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to address rust-skills findings in the rustledger-plugin crate by adding an inline hint, reducing allocations during plugin execution, and clarifying an error-handling decision.
Changes:
- Pre-allocate the
all_errorsvector inPluginManager::execute_all. - Add an inline hint to
plugin_short_namein the native plugin registry. - Document why
canonicalize()failures fall back to the original path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
crates/rustledger-plugin/src/runtime.rs |
Adjusts allocation strategy for aggregated plugin errors and documents canonicalization fallback behavior. |
crates/rustledger-plugin/src/native/mod.rs |
Adds an inline hint to a hot-path helper for native plugin name lookup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
📊 Benchmark Results
vs main branch (2026-04-11)
What do these numbers mean?
|
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
`NativePluginRegistry::execute_all` was preallocating `all_errors` with `Vec::with_capacity(self.plugins.len())` on every invocation, which meant an unconditional heap allocation even in the common no-errors path. Previously (`Vec::new()`), that path was zero-alloc. Revert to `Vec::new()`. `Vec::new()` is free until the first push, and the first `extend` from a non-empty `output.errors` pays for the first grow then. For the typical "plugins ran clean" case this saves one allocation per `execute_all` call. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
robcohen
enabled auto-merge
April 11, 2026 16:34
robcohen
added this pull request to the merge queue
Apr 11, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes rust-skills violations in the plugin crate related to inline hints, memory allocation, and error handling.
Changes
Impact
rust-skills Rules Addressed
opt-inline-hints✅ Fixedmem-vec-with-capacity✅ Fixederr-no-unwrap-prod✅ Documented