Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: derive Default for more structs #1824

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading