Per crate build optinos

I am confident I have asked this before, but I can't find the old post:

How do we specify per-crate build options in Cargo.toml ?

I.e. I want to say:

I don't care if we are building in release mode or debug mode, I want to build the image crate with opt-level=3, debug=false.


Set [profile.<name>.package.<name>] in config.toml Configuration - The Cargo Book

[profile.<name>]         # Modify profile settings via config.
inherits = "dev"         # Inherits settings from [].
opt-level = 0            # Optimization level.
debug = true             # Include debug info.
split-debuginfo = '...'  # Debug info splitting behavior.
debug-assertions = true  # Enables debug assertions.
overflow-checks = true   # Enables runtime integer overflow checks.
lto = false              # Sets link-time optimization.
panic = 'unwind'         # The panic strategy.
incremental = true       # Incremental compilation.
codegen-units = 16       # Number of code generation units.
rpath = false            # Sets the rpath linking option.
[profile.<name>.build-override]  # Overrides build-script settings.
# Same keys for a normal profile.
[profile.<name>.package.<name>]  # Override profile for a package.
# Same keys for a normal profile (minus `panic`, `lto`, and `rpath`).