From ddf04378160e76463f899ca6ab25b1c66ecc4a4d Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Tue, 8 Sep 2020 12:29:37 +0800 Subject: [PATCH] feat: add hashset eq check for irawrule --- scie-grammar/src/inter/location.rs | 4 ++-- scie-grammar/src/inter/raw_captures.rs | 4 ++-- scie-grammar/src/inter/raw_repository.rs | 4 ++-- scie-grammar/src/inter/raw_rule.rs | 2 +- scie-grammar/src/scope_dependency.rs | 3 +-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/scie-grammar/src/inter/location.rs b/scie-grammar/src/inter/location.rs index cad403a..f7c4ed7 100644 --- a/scie-grammar/src/inter/location.rs +++ b/scie-grammar/src/inter/location.rs @@ -1,4 +1,4 @@ -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] +#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] pub struct ILocation { pub filename: String, pub line: String, @@ -15,7 +15,7 @@ impl ILocation { } } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] +#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] pub struct ILocatable { #[serde(flatten, skip_serializing_if = "Option::is_none")] pub textmate_location: Option, diff --git a/scie-grammar/src/inter/raw_captures.rs b/scie-grammar/src/inter/raw_captures.rs index e8a759b..990aec6 100644 --- a/scie-grammar/src/inter/raw_captures.rs +++ b/scie-grammar/src/inter/raw_captures.rs @@ -1,13 +1,13 @@ use crate::inter::{ILocatable, IRawRule}; use std::collections::HashMap; -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] +#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] pub struct IRawCapturesMap { #[serde(flatten)] pub capture_map: HashMap, } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] +#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] pub struct IRawCaptures { #[serde(flatten)] pub map: IRawCapturesMap, diff --git a/scie-grammar/src/inter/raw_repository.rs b/scie-grammar/src/inter/raw_repository.rs index 105ebbc..e1b1130 100644 --- a/scie-grammar/src/inter/raw_repository.rs +++ b/scie-grammar/src/inter/raw_repository.rs @@ -1,7 +1,7 @@ use crate::inter::{ILocation, IRawRule}; use std::collections::HashMap; -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] +#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] pub struct IRawRepository { #[serde(flatten)] pub map: Box, @@ -18,7 +18,7 @@ impl IRawRepository { } } -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] +#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] pub struct IRawRepositoryMap { #[serde(flatten)] pub name_map: HashMap>, diff --git a/scie-grammar/src/inter/raw_rule.rs b/scie-grammar/src/inter/raw_rule.rs index 561a3d4..3941efe 100644 --- a/scie-grammar/src/inter/raw_rule.rs +++ b/scie-grammar/src/inter/raw_rule.rs @@ -1,6 +1,6 @@ use crate::inter::{ILocation, IRawCaptures, IRawRepository}; -#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] +#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)] pub struct IRawRule { pub id: Option, #[serde(skip_serializing_if = "Option::is_none")] diff --git a/scie-grammar/src/scope_dependency.rs b/scie-grammar/src/scope_dependency.rs index 92220ec..6141549 100644 --- a/scie-grammar/src/scope_dependency.rs +++ b/scie-grammar/src/scope_dependency.rs @@ -1,5 +1,5 @@ -use crate::inter::IRawRule; use std::collections::HashSet; +use crate::inter::IRawRule; #[derive(Clone, Debug, Serialize)] pub struct PartialScopeDependency { @@ -47,7 +47,6 @@ impl ScopeDependencyCollector { pub fn add(&mut self, dep: ScopeDependency) { match dep { ScopeDependency::FullScopeDependency(full_dep) => { - // self._seen_full.get_or_insert(full_dep.scope_name); // self._seen_full.get(&*full_dep.scope_name.clone()); }, ScopeDependency::PartialScopeDependency(_) => { -- GitLab