From ae2e70f8bc7c0214559bd89a1edabf247555335f Mon Sep 17 00:00:00 2001 From: precious1joe <162345921+precious1joe@users.noreply.github.com> Date: Sun, 27 Sep 2026 13:12:22 +0100 Subject: [PATCH 1/2] Fix #727: Review and optimize performance/allocations in `cargo-budget-report/src/arg_spec.rs` --- cargo-budget-report/src/arg_spec.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cargo-budget-report/src/arg_spec.rs b/cargo-budget-report/src/arg_spec.rs index 7d358bf5..2c7b7b57 100644 --- a/cargo-budget-report/src/arg_spec.rs +++ b/cargo-budget-report/src/arg_spec.rs @@ -59,7 +59,7 @@ pub(crate) struct TypedArg { /// Renders a function's whole `args` list to the flat CLI vector. pub(crate) fn render_args(specs: &[ArgSpec], function: &str) -> anyhow::Result> { - let mut out = Vec::new(); + let mut out = Vec::with_capacity(specs.len() * 2); for spec in specs { match spec { ArgSpec::Raw(s) => out.push(s.clone()), @@ -73,6 +73,7 @@ pub(crate) fn render_args(specs: &[ArgSpec], function: &str) -> anyhow::Result Date: Wed, 30 Sep 2026 21:56:34 +0100 Subject: [PATCH 2/2] test: restore compile-fail fixture inputs --- budget-macros/tests/ui/budget_lt_unknown_property.rs | 9 ++++++++- budget-macros/tests/ui/env_file_missing_file.rs | 10 +++++++++- budget-macros/tests/ui/invalid_arg.rs | 9 ++++++++- budget-macros/tests/ui/scaling_unknown_model.rs | 10 +++++++++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/budget-macros/tests/ui/budget_lt_unknown_property.rs b/budget-macros/tests/ui/budget_lt_unknown_property.rs index 7e1f33a0..3eac99c3 100644 --- a/budget-macros/tests/ui/budget_lt_unknown_property.rs +++ b/budget-macros/tests/ui/budget_lt_unknown_property.rs @@ -1 +1,8 @@ -// Optimized budget_lt_unknown_property.rs allocations +//! The `budget_lt` macro must reject unsupported configuration keys. + +use budget_macros::budget_lt; + +#[budget_lt(unknown_prop = 1000)] +fn test_unknown_property() {} + +fn main() {} diff --git a/budget-macros/tests/ui/env_file_missing_file.rs b/budget-macros/tests/ui/env_file_missing_file.rs index 239c1fac..faf4a3c6 100644 --- a/budget-macros/tests/ui/env_file_missing_file.rs +++ b/budget-macros/tests/ui/env_file_missing_file.rs @@ -1 +1,9 @@ -// Documented env_file_missing_file.rs behavior +//! An env file path that does not exist must be rejected during expansion. + +use budget_macros::budget_cpu_lt; + +// Keep the attribute on the documented line used by the compile-fail snapshot. +#[budget_cpu_lt(env_file = "definitely/not/a/real/limits.env", env = "SOME_LIMIT")] +fn test_env_file_missing_file() {} + +fn main() {} diff --git a/budget-macros/tests/ui/invalid_arg.rs b/budget-macros/tests/ui/invalid_arg.rs index 48fc5cbd..9377b453 100644 --- a/budget-macros/tests/ui/invalid_arg.rs +++ b/budget-macros/tests/ui/invalid_arg.rs @@ -1 +1,8 @@ -// Optimized invalid_arg.rs allocations +//! The `budget_cpu_lt` macro must reject unsupported argument names. + +use budget_macros::budget_cpu_lt; + +#[budget_cpu_lt(wrong = "500")] +fn test_invalid_argument() {} + +fn main() {} diff --git a/budget-macros/tests/ui/scaling_unknown_model.rs b/budget-macros/tests/ui/scaling_unknown_model.rs index f9a19f69..dd4b0938 100644 --- a/budget-macros/tests/ui/scaling_unknown_model.rs +++ b/budget-macros/tests/ui/scaling_unknown_model.rs @@ -1 +1,9 @@ -// Added documentation for scaling_unknown_model.rs +//! Scaling configuration must use one of the supported growth models. + +use budget_macros::budget_scaling; + +// Keep the attribute on the documented line used by the compile-fail snapshot. +#[budget_scaling(sizes = [10, 100], model = exponential, tolerance = 0.3)] +fn test_unknown_growth_model() {} + +fn main() {}