Skip to content

Commit

Permalink
Derive Eq in addition to PartialEq
Browse files Browse the repository at this point in the history
  • Loading branch information
charlespierce committed Sep 16, 2022
1 parent 7686f44 commit 7c9d649
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion crates/validate-npm-package-name/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ lazy_static! {
];
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum Validity {
/// Valid for new and old packages
Valid,
Expand Down
2 changes: 1 addition & 1 deletion crates/volta-core/src/error/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ https://github.com/volta-cli/volta/issues with the details!";
const PERMISSIONS_CTA: &str = "Please ensure you have correct permissions to the Volta directory.";

#[derive(Debug)]
#[cfg_attr(test, derive(PartialEq))]
#[cfg_attr(test, derive(PartialEq, Eq))]
pub enum ErrorKind {
/// Thrown when package tries to install a binary that is already installed.
BinaryAlreadyInstalled {
Expand Down
4 changes: 2 additions & 2 deletions crates/volta-core/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct Event {
pub event: EventKind,
}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
#[derive(Deserialize, Serialize, PartialEq, Eq, Debug)]
pub struct ErrorEnv {
argv: String,
exec_path: String,
Expand All @@ -27,7 +27,7 @@ pub struct ErrorEnv {
platform_version: String,
}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
#[derive(Deserialize, Serialize, PartialEq, Eq, Debug)]
#[serde(rename_all = "lowercase")]
pub enum EventKind {
Start,
Expand Down
4 changes: 2 additions & 2 deletions crates/volta-core/src/hook/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub(crate) mod serial;
pub mod tool;

/// A hook for publishing Volta events.
#[derive(PartialEq, Debug)]
#[derive(PartialEq, Eq, Debug)]
pub enum Publish {
/// Reports an event by sending a POST request to a URL.
Url(String),
Expand Down Expand Up @@ -221,7 +221,7 @@ impl HookConfig {
}

/// Format of the registry used for Yarn (Npm or Github)
#[derive(PartialEq, Debug)]
#[derive(PartialEq, Eq, Debug)]
pub enum RegistryFormat {
Npm,
Github,
Expand Down
6 changes: 3 additions & 3 deletions crates/volta-core/src/hook/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ lazy_static! {
}

/// A hook for resolving the distro URL for a given tool version
#[derive(PartialEq, Debug)]
#[derive(PartialEq, Eq, Debug)]
pub enum DistroHook {
Prefix(String),
Template(String),
Expand Down Expand Up @@ -79,7 +79,7 @@ fn calculate_extension(filename: &str) -> Option<&str> {
}

/// A hook for resolving the URL for metadata about a tool
#[derive(PartialEq, Debug)]
#[derive(PartialEq, Eq, Debug)]
pub enum MetadataHook {
Prefix(String),
Template(String),
Expand All @@ -101,7 +101,7 @@ impl MetadataHook {
}

/// A hook for resolving the URL for the Yarn index
#[derive(PartialEq, Debug)]
#[derive(PartialEq, Eq, Debug)]
pub struct YarnIndexHook {
pub format: RegistryFormat,
pub metadata: MetadataHook,
Expand Down
2 changes: 1 addition & 1 deletion crates/volta-core/src/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn entry_to_shim_name((entry, metadata): (DirEntry, Metadata)) -> Option<String>
}
}

#[derive(PartialEq)]
#[derive(PartialEq, Eq)]
pub enum ShimResult {
Created,
AlreadyExists,
Expand Down
2 changes: 1 addition & 1 deletion crates/volta-core/src/tool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub trait Tool: Display {

/// Specification for a tool and its associated version.
#[derive(Debug)]
#[cfg_attr(test, derive(PartialEq))]
#[cfg_attr(test, derive(PartialEq, Eq))]
pub enum Spec {
Node(VersionSpec),
Npm(VersionSpec),
Expand Down
4 changes: 2 additions & 2 deletions crates/volta-core/src/toolchain/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ use semver::Version;
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;

#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub struct NodeVersion {
#[serde(with = "version_serde")]
pub runtime: Version,
#[serde(with = "option_version_serde")]
pub npm: Option<Version>,
}

#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub struct Platform {
#[serde(default)]
pub node: Option<NodeVersion>,
Expand Down
4 changes: 2 additions & 2 deletions crates/volta-core/src/version/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use semver::{Version, VersionReq};
mod serial;

#[derive(Debug)]
#[cfg_attr(test, derive(PartialEq))]
#[cfg_attr(test, derive(PartialEq, Eq))]
pub enum VersionSpec {
/// No version specified (default)
None,
Expand All @@ -23,7 +23,7 @@ pub enum VersionSpec {
}

#[derive(Debug)]
#[cfg_attr(test, derive(PartialEq))]
#[cfg_attr(test, derive(PartialEq, Eq))]
pub enum VersionTag {
/// The 'latest' tag, a special case that exists for all packages
Latest,
Expand Down

0 comments on commit 7c9d649

Please sign in to comment.