diff --git a/budget-macros/tests/ui/budget_lt_unknown_property.rs b/budget-macros/tests/ui/budget_lt_unknown_property.rs index 58d20d91..3eac99c3 100644 --- a/budget-macros/tests/ui/budget_lt_unknown_property.rs +++ b/budget-macros/tests/ui/budget_lt_unknown_property.rs @@ -1,10 +1,8 @@ -//! `budget_lt` with an unknown property name. +//! The `budget_lt` macro must reject unsupported configuration keys. use budget_macros::budget_lt; #[budget_lt(unknown_prop = 1000)] -fn test_unknown_property() { - let env = (); -} +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 c4e1a59c..faf4a3c6 100644 --- a/budget-macros/tests/ui/env_file_missing_file.rs +++ b/budget-macros/tests/ui/env_file_missing_file.rs @@ -1,11 +1,9 @@ +//! An env file path that does not exist must be rejected during expansion. + use budget_macros::budget_cpu_lt; -// A literal `env_file` path that does not resolve to a file must fail at -// compile time, naming the path — not defer to a runtime panic and not -// silently fall through to `u64::MAX`. +// 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_missing_env_file() { - let env = (); -} +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 0917a243..9377b453 100644 --- a/budget-macros/tests/ui/invalid_arg.rs +++ b/budget-macros/tests/ui/invalid_arg.rs @@ -1,10 +1,8 @@ +//! The `budget_cpu_lt` macro must reject unsupported argument names. + use budget_macros::budget_cpu_lt; -// The BudgetLimit parser expects either an integer literal or `env`/`config` -// identifiers. Passing `wrong` should produce a clear error message. #[budget_cpu_lt(wrong = "500")] -fn test_invalid_arg() { - let env = (); -} +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 d70f660d..dd4b0938 100644 --- a/budget-macros/tests/ui/scaling_unknown_model.rs +++ b/budget-macros/tests/ui/scaling_unknown_model.rs @@ -1,12 +1,9 @@ -//! `budget_scaling` with an unrecognized growth model: the parser must reject -//! unknown model names at compile time. +//! 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_model() { - // Body is irrelevant — the attribute parser rejects the model before the - // body is emitted. -} +fn test_unknown_growth_model() {} fn main() {} diff --git a/cargo-budget-report/src/arg_spec.rs b/cargo-budget-report/src/arg_spec.rs index 636da9a0..fe4586aa 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