From 45f49378fa12cddd0d2dac31b671b9b075ffe4d0 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Tue, 3 Oct 2023 03:34:55 +0200 Subject: [PATCH] is_syntactic_subtype(): remove option in Err variant --- src/subtype.rs | 8 ++++---- src/test/subtype.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/subtype.rs b/src/subtype.rs index 8f398b1..8c46752 100644 --- a/src/subtype.rs +++ b/src/subtype.rs @@ -19,20 +19,20 @@ impl TypeTerm { None } - pub fn is_syntactic_subtype_of(&self, expected_type: &TypeTerm) -> Result> { + pub fn is_syntactic_subtype_of(&self, expected_type: &TypeTerm) -> Result { if let Some((first_match, provided_type)) = self.is_semantic_subtype_of( expected_type ) { let provided_lnf = provided_type.get_lnf_vec(); let expected_lnf = expected_type.clone().get_lnf_vec(); for i in 0 .. usize::min( provided_lnf.len(), expected_lnf.len() ) { if provided_lnf[i] != expected_lnf[i] { - return Err(Some((first_match, first_match+i))) + return Err((first_match, first_match+i)) } } Ok(first_match) } else { - Err(None) + Err((0,0)) } } @@ -43,7 +43,7 @@ impl TypeTerm { t.is_semantic_subtype_of(self) } - pub fn is_syntactic_supertype_of(&self, t: &TypeTerm) -> Result> { + pub fn is_syntactic_supertype_of(&self, t: &TypeTerm) -> Result { t.is_syntactic_subtype_of(self) } } diff --git a/src/test/subtype.rs b/src/test/subtype.rs index 54ad397..08cc5c7 100644 --- a/src/test/subtype.rs +++ b/src/test/subtype.rs @@ -62,7 +62,7 @@ fn test_syntactic_subtype() { .is_syntactic_subtype_of( &dict.parse("C~G").expect("parse errror") ), - Err(Some((2,3))) + Err((2,3)) ); assert_eq!( @@ -70,7 +70,7 @@ fn test_syntactic_subtype() { .is_syntactic_subtype_of( &dict.parse("G~F~K").expect("parse errror") ), - Err(None) + Err((0,0)) ); assert_eq!(