Skip to content

Commit

Permalink
Fix log_feature_error formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nicopap committed Oct 27, 2023
1 parent a6d6baf commit ea4ab77
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions crates/bevy_core_pipeline/src/tonemapping/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,15 @@ impl Tonemapping {
Self::BlenderFilmic => "TONEMAP_METHOD_BLENDER_FILMIC",
}
}
#[cfg(feature = "tonemapping_luts")]
pub const fn log_feature_error(self) {}

#[cfg(not(feature = "tonemapping_luts"))]
pub const fn log_feature_error(self) {
let error_message = || {
format!("{self:?} tonemapping requires the `tonemapping_luts` feature.
Either enable the `tonemapping_luts` feature for bevy in `Cargo.toml` (recommended),
or use a different `Tonemapping` method in your `Camera2dBundle`/`Camera3dBundle`.")
};

pub fn log_feature_error(self) {
#[cfg(not(feature = "tonemapping_luts"))]
if matches!(self, Self::AgX | Self::TonyMcMapface | Self::BlenderFilmic) {
bevy_log::error!(error_message());
bevy_log::error!(
"{self:?} tonemapping requires the `tonemapping_luts` feature. Either enable the \
`tonemapping_luts` feature for bevy in `Cargo.toml` (recommended), or use a \
different `Tonemapping` method in your `Camera2dBundle`/`Camera3dBundle`."
);
}
}
}
Expand Down

0 comments on commit ea4ab77

Please sign in to comment.