From e3ae2832daa6ab942bfed6fac55e7a14bdee7b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lo=C3=AFs?= <elois@ifee.fr> Date: Tue, 20 Nov 2018 19:58:10 +0100 Subject: [PATCH] [feat] #109 --- lib/wot/data/mod.rs | 2 -- lib/wot/data/rusty.rs | 2 -- lib/wot/lib.rs | 8 -------- 3 files changed, 12 deletions(-) diff --git a/lib/wot/data/mod.rs b/lib/wot/data/mod.rs index e88b6933..d7851b23 100644 --- a/lib/wot/data/mod.rs +++ b/lib/wot/data/mod.rs @@ -87,8 +87,6 @@ impl<'de> Deserialize<'de> for NodeId { pub enum NewLinkResult { /// Certification worked. Ok(usize), - /// This certification already exist. - AlreadyCertified(usize), /// All available certifications has been used. AllCertificationsUsed(usize), /// Unknown source. diff --git a/lib/wot/data/rusty.rs b/lib/wot/data/rusty.rs index 22cdd866..33090225 100644 --- a/lib/wot/data/rusty.rs +++ b/lib/wot/data/rusty.rs @@ -134,8 +134,6 @@ impl WebOfTrust for RustyWebOfTrust { NewLinkResult::UnknownTarget() } else if self.nodes[source.0].issued_count >= self.max_links { NewLinkResult::AllCertificationsUsed(self.nodes[target.0].links_source.len()) - } else if self.nodes[target.0].links_source.contains(&source) { - NewLinkResult::AlreadyCertified(self.nodes[target.0].links_source.len()) } else { self.nodes[source.0].issued_count += 1; self.nodes[target.0].links_source.insert(source); diff --git a/lib/wot/lib.rs b/lib/wot/lib.rs index de3734d8..669613ce 100644 --- a/lib/wot/lib.rs +++ b/lib/wot/lib.rs @@ -196,14 +196,6 @@ mod tests { // should be able to add some links, cert count is returned assert_eq!(wot.add_link(NodeId(2), NodeId(0)), NewLinkResult::Ok(1)); assert_eq!(wot.add_link(NodeId(4), NodeId(0)), NewLinkResult::Ok(2)); - assert_eq!( - wot.add_link(NodeId(4), NodeId(0)), - NewLinkResult::AlreadyCertified(2) - ); - assert_eq!( - wot.add_link(NodeId(4), NodeId(0)), - NewLinkResult::AlreadyCertified(2) - ); assert_eq!(wot.add_link(NodeId(5), NodeId(0)), NewLinkResult::Ok(3)); // should exist new links -- GitLab