From dd85dd68f266bcbf71f57f4ac47b328506e6757a Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Thu, 30 Jun 2022 15:17:45 -0700 Subject: [PATCH] deps: Upgrade to Rust 1.62. (#173) * Update toolchain. * Update enums. * Update changelog. --- .github/workflows/moon.yml | 2 +- .github/workflows/rust.yml | 6 +++--- crates/cli/src/commands/init.rs | 18 ++++-------------- crates/cli/src/commands/run.rs | 9 ++------- crates/cli/src/enums.rs | 18 ++++-------------- crates/config/src/project/mod.rs | 18 ++++-------------- crates/config/src/project/task.rs | 18 ++++-------------- crates/config/src/workspace/vcs.rs | 9 ++------- packages/cli/CHANGELOG.md | 6 ++++++ rust-toolchain.toml | 2 +- 10 files changed, 31 insertions(+), 75 deletions(-) diff --git a/.github/workflows/moon.yml b/.github/workflows/moon.yml index 59f24e42176..1a9d4c37a8c 100644 --- a/.github/workflows/moon.yml +++ b/.github/workflows/moon.yml @@ -52,7 +52,7 @@ jobs: restore-keys: ${{ runner.os }}-moon-node@${{ matrix.node-version }}- - uses: actions-rs/toolchain@v1 with: - toolchain: 1.61.0 + toolchain: 1.62.0 profile: minimal - uses: moonrepo/tool-version-action@v1 with: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 244be06338f..90a6bfd5d7c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,7 +33,7 @@ jobs: - uses: actions-rs/toolchain@v1 name: Setup toolchain with: - toolchain: 1.61.0 + toolchain: 1.62.0 profile: minimal components: rustfmt - uses: actions-rs/cargo@v1 @@ -62,7 +62,7 @@ jobs: - uses: actions-rs/toolchain@v1 name: Setup toolchain with: - toolchain: 1.61.0 + toolchain: 1.62.0 profile: minimal components: clippy - uses: actions-rs/cargo@v1 @@ -91,7 +91,7 @@ jobs: - uses: actions-rs/toolchain@v1 name: Setup toolchain with: - toolchain: 1.61.0 + toolchain: 1.62.0 profile: minimal components: llvm-tools-preview - uses: actions-rs/cargo@v1 diff --git a/crates/cli/src/commands/init.rs b/crates/cli/src/commands/init.rs index 671de9a31c6..d7a3d87f7e6 100644 --- a/crates/cli/src/commands/init.rs +++ b/crates/cli/src/commands/init.rs @@ -20,8 +20,9 @@ use std::io::prelude::*; use std::path::{Path, PathBuf}; use tera::{Context, Tera}; -#[derive(ArgEnum, Clone, Debug)] +#[derive(ArgEnum, Clone, Debug, Default)] pub enum PackageManager { + #[default] Npm, Pnpm, Yarn, @@ -37,14 +38,9 @@ impl PackageManager { } } -impl Default for PackageManager { - fn default() -> Self { - PackageManager::Npm - } -} - -#[derive(ArgEnum, Clone, Debug)] +#[derive(ArgEnum, Clone, Debug, Default)] pub enum InheritProjectsAs { + #[default] None, GlobsList, ProjectsMap, @@ -60,12 +56,6 @@ impl InheritProjectsAs { } } -impl Default for InheritProjectsAs { - fn default() -> Self { - InheritProjectsAs::None - } -} - pub struct InitOptions { pub force: bool, pub inherit_projects: InheritProjectsAs, diff --git a/crates/cli/src/commands/run.rs b/crates/cli/src/commands/run.rs index a69adce94e5..d6aa53cffa6 100644 --- a/crates/cli/src/commands/run.rs +++ b/crates/cli/src/commands/run.rs @@ -10,9 +10,10 @@ use std::string::ToString; use std::time::Duration; use strum_macros::Display; -#[derive(ArgEnum, Clone, Debug, Display)] +#[derive(ArgEnum, Clone, Debug, Display, Default)] pub enum RunStatus { Added, + #[default] All, Deleted, Modified, @@ -21,12 +22,6 @@ pub enum RunStatus { Untracked, } -impl Default for RunStatus { - fn default() -> Self { - RunStatus::All - } -} - pub struct RunOptions { pub affected: bool, pub dependents: bool, diff --git a/crates/cli/src/enums.rs b/crates/cli/src/enums.rs index 0ba2423367f..066464d5bac 100644 --- a/crates/cli/src/enums.rs +++ b/crates/cli/src/enums.rs @@ -1,31 +1,21 @@ use clap::ArgEnum; use strum_macros::Display; -#[derive(ArgEnum, Clone, Debug, Display)] +#[derive(ArgEnum, Clone, Debug, Default, Display)] pub enum CacheMode { Off, Read, + #[default] Write, } -impl Default for CacheMode { - fn default() -> Self { - CacheMode::Write - } -} - -#[derive(ArgEnum, Clone, Debug, Display)] +#[derive(ArgEnum, Clone, Debug, Default, Display)] pub enum LogLevel { Off, Error, Warn, + #[default] Info, Debug, Trace, } - -impl Default for LogLevel { - fn default() -> Self { - LogLevel::Info - } -} diff --git a/crates/config/src/project/mod.rs b/crates/config/src/project/mod.rs index 36bd1704b0c..bb49f1669a9 100644 --- a/crates/config/src/project/mod.rs +++ b/crates/config/src/project/mod.rs @@ -56,35 +56,25 @@ fn validate_channel(value: &str) -> Result<(), ValidationError> { Ok(()) } -#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Serialize)] #[serde(rename_all = "lowercase")] pub enum ProjectLanguage { JavaScript, + #[default] TypeScript, Unknown, } -impl Default for ProjectLanguage { - fn default() -> Self { - ProjectLanguage::TypeScript - } -} - -#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Serialize)] #[serde(rename_all = "lowercase")] pub enum ProjectType { Application, + #[default] Library, Tool, Unknown, } -impl Default for ProjectType { - fn default() -> Self { - ProjectType::Library - } -} - #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize, Validate)] pub struct ProjectMetadataConfig { pub name: String, diff --git a/crates/config/src/project/task.rs b/crates/config/src/project/task.rs index 63dffa1b0ab..b89a111c272 100644 --- a/crates/config/src/project/task.rs +++ b/crates/config/src/project/task.rs @@ -37,33 +37,23 @@ fn validate_outputs(list: &[String]) -> Result<(), ValidationError> { Ok(()) } -#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Serialize)] #[serde(rename_all = "lowercase")] pub enum TaskType { + #[default] Node, System, } -impl Default for TaskType { - fn default() -> Self { - TaskType::Node - } -} - -#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Serialize)] #[serde(rename_all = "lowercase")] pub enum TaskMergeStrategy { + #[default] Append, Prepend, Replace, } -impl Default for TaskMergeStrategy { - fn default() -> Self { - TaskMergeStrategy::Append - } -} - #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize, Validate)] #[serde(rename_all = "camelCase")] pub struct TaskOptionsConfig { diff --git a/crates/config/src/workspace/vcs.rs b/crates/config/src/workspace/vcs.rs index 89a0fd050f9..c1d73672594 100644 --- a/crates/config/src/workspace/vcs.rs +++ b/crates/config/src/workspace/vcs.rs @@ -2,19 +2,14 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use validator::Validate; -#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Serialize)] #[serde(rename_all = "lowercase")] pub enum VcsManager { + #[default] Git, Svn, } -impl Default for VcsManager { - fn default() -> Self { - VcsManager::Git - } -} - #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize, Validate)] #[schemars(default)] #[serde(rename_all = "camelCase")] diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 57051858403..34b2ff99c20 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +#### ⚙️ Internal + +- Updated Rust to v1.62. + ## 0.5.0 #### 🚀 Updates diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 4badbf74f8b..5a3a161e59b 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,4 +2,4 @@ # The default profile includes rustc, rust-std, cargo, rust-docs, rustfmt and clippy. # https://rust-lang.github.io/rustup/concepts/profiles.html profile = "default" -channel = "1.61.0" +channel = "1.62.0"