diff --git a/src/project/manifest/validation.rs b/src/project/manifest/validation.rs index c194389d1..4bd31754e 100644 --- a/src/project/manifest/validation.rs +++ b/src/project/manifest/validation.rs @@ -36,6 +36,22 @@ impl ProjectManifest { } } + // Check if all features are used in environments, warn if not. + let mut features_used = HashSet::new(); + for env in self.environments.values() { + for feature in env.features.iter() { + features_used.insert(feature); + } + } + for (name, _feature) in self.features.iter() { + if name != &FeatureName::Default && !features_used.contains(&name.to_string()) { + tracing::warn!( + "The feature '{}' is defined but not used in any environment", + console::style(name).bold().blue() + ); + } + } + // parse the SPDX license expression to make sure that it is a valid expression. if let Some(spdx_expr) = &self.project.license { spdx::Expression::parse(spdx_expr)