Skip to content

Commit

Permalink
refactor: derive Default for more structs (#1824)
Browse files Browse the repository at this point in the history
derive `Default` for more `Environment` and `EnvironmentName`
  • Loading branch information
Hofer-Julian authored Aug 16, 2024
1 parent 1432a0b commit 3382439
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions crates/pixi_manifest/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ use crate::utils::PixiSpanned;

/// The name of an environment. This is either a string or default for the
/// default environment.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, SerializeDisplay)]
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, SerializeDisplay)]
pub enum EnvironmentName {
#[default]
Default,
Named(String),
}
Expand Down Expand Up @@ -126,7 +127,7 @@ impl<'de> Deserialize<'de> for EnvironmentName {
///
/// Individual features cannot be used directly, instead they are grouped
/// together into environments. Environments are then locked and installed.
#[derive(Debug, Clone)]
#[derive(Debug, Default, Clone)]
pub struct Environment {
/// The name of the environment
pub name: EnvironmentName,
Expand All @@ -150,18 +151,6 @@ pub struct Environment {
pub no_default_feature: bool,
}

impl Default for Environment {
fn default() -> Self {
Self {
name: EnvironmentName::Default,
features: Vec::new(),
features_source_loc: None,
solve_group: None,
no_default_feature: false,
}
}
}

/// Helper struct to deserialize the environment from TOML.
/// The environment description can only hold these values.
#[derive(Deserialize)]
Expand Down

0 comments on commit 3382439

Please sign in to comment.