Cargo has two main profiles: the profile Cargo uses when you run cargo build and the release profile Cargo uses when you run cargo build --release. The dev profile is defined with good defaults for development, and the release profile has good defaults for release builds.

    These profile names might be familiar from the output of your builds:

    Cargo has default settings for each of the profiles that apply when you haven't explicitly added any sections in the project’s Cargo.toml file. By adding [profile.*] sections for any profile you want to customize, you override any subset of the default settings. For example, here are the default values for the opt-level setting for the dev and release profiles:

    Filename: Cargo.toml

    You can override a default setting by adding a different value for it in Cargo.toml. For example, if we want to use optimization level 1 in the development profile, we can add these two lines to our project’s Cargo.toml file:

    Filename: Cargo.toml

    For the full list of configuration options and defaults for each profile, see Cargo’s documentation.