diff --git a/src/main.rs b/src/main.rs index df5f294..3737c53 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ clippy::expect_used )] mod types; -use crate::types::{Bitness, BuildSettings, BuildStatistics, LoveVersion, Platform, Project, Target}; +use crate::types::{Bitness, BuildSettings, BuildStatistics, LoveVersion, Platform, Project, Target, LOVE_VERSIONS}; mod build; mod download; @@ -51,7 +51,7 @@ enum BoonOpt { long, short, help = "Specify which target version of LÖVE to build for", - possible_values=&LoveVersion::variants(), + possible_values=LOVE_VERSIONS, default_value="11.5", )] version: LoveVersion, @@ -69,12 +69,12 @@ enum BoonOpt { enum LoveSubcommand { #[structopt(about = "Download a version of LÖVE")] Download { - #[structopt(possible_values=&LoveVersion::variants())] + #[structopt(possible_values=LOVE_VERSIONS)] version: LoveVersion, }, #[structopt(about = "Remove a version of LÖVE")] Remove { - #[structopt(possible_values=&LoveVersion::variants())] + #[structopt(possible_values=LOVE_VERSIONS)] version: LoveVersion, }, #[structopt(about = "List installed LÖVE versions")] diff --git a/src/types.rs b/src/types.rs index 8a53dcc..2fb0d38 100644 --- a/src/types.rs +++ b/src/types.rs @@ -42,7 +42,8 @@ pub enum Bitness { X64, // 64 bit } -const LOVE_VERSIONS: [&str; 6] = ["11.5", "11.4", "11.3", "11.2", "11.1", "11.0", "0.10.2"]; +pub static LOVE_VERSIONS: &[&str] = &["11.5", "11.4", "11.3", "11.2", "11.1", "11.0", "0.10.2"]; + /// Represents a specific version of LÖVE2D #[derive(Copy, Clone, Debug, Primitive)] pub enum LoveVersion { @@ -87,12 +88,6 @@ impl FromStr for LoveVersion { } } -impl LoveVersion { - pub const fn variants() -> [&'static str; 6] { - LOVE_VERSIONS - } -} - impl Display for LoveVersion { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!(f, "{}", LOVE_VERSIONS[*self as usize])