Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions budget-macros/tests/ui/budget_lt_unknown_property.rs
Original file line number Diff line number Diff line change
@@ -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() {}
10 changes: 4 additions & 6 deletions budget-macros/tests/ui/env_file_missing_file.rs
Original file line number Diff line number Diff line change
@@ -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() {}
8 changes: 3 additions & 5 deletions budget-macros/tests/ui/invalid_arg.rs
Original file line number Diff line number Diff line change
@@ -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() {}
9 changes: 3 additions & 6 deletions budget-macros/tests/ui/scaling_unknown_model.rs
Original file line number Diff line number Diff line change
@@ -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() {}
3 changes: 2 additions & 1 deletion cargo-budget-report/src/arg_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<String>> {
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()),
Expand All @@ -73,6 +73,7 @@ pub(crate) fn render_args(specs: &[ArgSpec], function: &str) -> anyhow::Result<V
}
}
}
out.shrink_to_fit();
Ok(out)
}

Expand Down
Loading