mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-01 18:56:38 +03:00
Prefer manual Eq impl
This commit is contained in:
parent
1ef9b33dec
commit
1779bb04e0
@ -34,7 +34,7 @@ use std::{
|
||||
///
|
||||
/// This type should be added to the circuit symbol table for a resolved syntax tree.
|
||||
/// This is a user-defined type.
|
||||
#[derive(Clone, Debug, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct CircuitType {
|
||||
/// The name of the circuit definition.
|
||||
pub identifier: Identifier,
|
||||
@ -185,6 +185,8 @@ impl PartialEq for CircuitType {
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for CircuitType {}
|
||||
|
||||
impl Hash for CircuitType {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.identifier.hash(state);
|
||||
|
@ -20,7 +20,7 @@ use leo_typed::{FunctionInputVariable, Identifier, Span};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
#[derive(Clone, Debug, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct FunctionInputVariableType {
|
||||
/// Name of function input.
|
||||
pub identifier: Identifier,
|
||||
@ -110,6 +110,8 @@ impl PartialEq for FunctionInputVariableType {
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for FunctionInputVariableType {}
|
||||
|
||||
impl Hash for FunctionInputVariableType {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.identifier.hash(state)
|
||||
|
@ -24,7 +24,7 @@ use std::{
|
||||
/// Stores variable definition details.
|
||||
///
|
||||
/// This type should be added to the variable symbol table for a resolved syntax tree.
|
||||
#[derive(Clone, Debug, Eq)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ParameterType {
|
||||
pub identifier: Identifier,
|
||||
pub type_: Type,
|
||||
@ -77,6 +77,8 @@ impl PartialEq for ParameterType {
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for ParameterType {}
|
||||
|
||||
impl Hash for ParameterType {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.identifier.hash(state);
|
||||
|
@ -19,7 +19,7 @@ use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// An unknown type in a Leo program.
|
||||
#[derive(Clone, Debug, Eq, Hash, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct TypeVariable {
|
||||
identifier: Identifier,
|
||||
}
|
||||
@ -42,3 +42,5 @@ impl PartialEq for TypeVariable {
|
||||
self.identifier.name.eq(&other.identifier.name) || self.identifier.span.eq(&other.identifier.span)
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for TypeVariable {}
|
||||
|
@ -43,7 +43,7 @@ use std::{
|
||||
/// Attention - When adding or removing fields from this struct,
|
||||
/// please remember to update it's Serialize and Deserialize implementation
|
||||
/// to reflect the new struct instantiation.
|
||||
#[derive(Clone, Eq)]
|
||||
#[derive(Clone)]
|
||||
pub struct Identifier {
|
||||
pub name: String,
|
||||
pub span: Span,
|
||||
@ -181,6 +181,8 @@ impl PartialEq for Identifier {
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Identifier {}
|
||||
|
||||
impl Hash for Identifier {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.name.hash(state);
|
||||
|
@ -18,7 +18,7 @@ use pest::Span as AstSpan;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
#[derive(Clone, Debug, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Span {
|
||||
/// text of input string
|
||||
pub text: String,
|
||||
@ -36,6 +36,8 @@ impl PartialEq for Span {
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Span {}
|
||||
|
||||
impl Hash for Span {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.line.hash(state);
|
||||
|
Loading…
Reference in New Issue
Block a user