diff --git a/earthly/rust/stdcfgs/cargo_manifest/project.toml b/earthly/rust/stdcfgs/cargo_manifest/project.toml index f4899878a..88a0c6779 100644 --- a/earthly/rust/stdcfgs/cargo_manifest/project.toml +++ b/earthly/rust/stdcfgs/cargo_manifest/project.toml @@ -36,3 +36,5 @@ unchecked_duration_subtraction = "deny" unreachable = "deny" missing_docs_in_private_items = "deny" arithmetic_side_effects = "deny" +use_debug = "deny" +disallowed-macros = "deny" diff --git a/earthly/rust/stdcfgs/cargo_manifest/workspace.toml b/earthly/rust/stdcfgs/cargo_manifest/workspace.toml index f03b03828..e6ac972ac 100644 --- a/earthly/rust/stdcfgs/cargo_manifest/workspace.toml +++ b/earthly/rust/stdcfgs/cargo_manifest/workspace.toml @@ -36,3 +36,5 @@ unchecked_duration_subtraction = "deny" unreachable = "deny" missing_docs_in_private_items = "deny" arithmetic_side_effects = "deny" +use_debug = "deny" +disallowed-macros = "deny" diff --git a/earthly/rust/stdcfgs/clippy.toml b/earthly/rust/stdcfgs/clippy.toml index caa289b27..3e9f94142 100644 --- a/earthly/rust/stdcfgs/clippy.toml +++ b/earthly/rust/stdcfgs/clippy.toml @@ -2,3 +2,6 @@ allow-unwrap-in-tests = true allow-expect-in-tests = true allow-panic-in-tests = true arithmetic-side-effects-allowed = ["num_bigint::BigInt"] +disallowed-macros = [ + { path = "std::fmt::Debug", reason = "Debug Formatting not permitted in production release code.\nUse `#[cfg_attr(debug_assertions, derive(Debug))]` instead." }, +] diff --git a/examples/rust/Cargo.toml b/examples/rust/Cargo.toml index 0b8607d25..0fa57a187 100644 --- a/examples/rust/Cargo.toml +++ b/examples/rust/Cargo.toml @@ -45,3 +45,5 @@ unchecked_duration_subtraction = "deny" unreachable = "deny" missing_docs_in_private_items = "deny" arithmetic_side_effects = "deny" +use_debug = "deny" +disallowed-macros = "deny" diff --git a/examples/rust/clippy.toml b/examples/rust/clippy.toml index caa289b27..2a139cd09 100644 --- a/examples/rust/clippy.toml +++ b/examples/rust/clippy.toml @@ -2,3 +2,6 @@ allow-unwrap-in-tests = true allow-expect-in-tests = true allow-panic-in-tests = true arithmetic-side-effects-allowed = ["num_bigint::BigInt"] +disallowed-macros = [ + { path = "std::fmt::Debug", reason = "Debug Formatting not permitted in production release code.\nUse #[cfg_attr(debug_assertions, derive(Debug)] instead." }, +] diff --git a/examples/rust/crates/foo/src/main.rs b/examples/rust/crates/foo/src/main.rs index e2bd9f32b..77101ac19 100644 --- a/examples/rust/crates/foo/src/main.rs +++ b/examples/rust/crates/foo/src/main.rs @@ -5,7 +5,8 @@ use clap::Parser; use foo::fmt_hello; /// Simple program to greet a person -#[derive(Parser, Debug)] +#[cfg_attr(debug_assertions, derive(Debug))] +#[derive(Parser)] #[command(author, version, about, long_about = None)] struct Args { /// Name of the person to greet @@ -21,6 +22,9 @@ struct Args { fn main() { let args = Args::parse(); + #[cfg(debug_assertions)] + println!("{args:?}"); + for cnt in 0..args.count { println!("{}", fmt_hello(&args.name, cnt)); }