From 4c45590553c59593ec6b7b5119a547c55bc07551 Mon Sep 17 00:00:00 2001 From: Jose Emilio Labra Gayo Date: Wed, 30 Oct 2024 13:10:17 +0100 Subject: [PATCH] Clippied --- shacl_ast/src/converter/rdf_to_shacl/shacl_parser.rs | 2 +- .../src/constraints/core/string_based/max_length.rs | 2 +- .../src/constraints/core/string_based/min_length.rs | 2 +- srdf/src/srdf_basic.rs | 6 +++--- srdf/src/srdf_parser/rdf_node_parser.rs | 12 ++++++------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/shacl_ast/src/converter/rdf_to_shacl/shacl_parser.rs b/shacl_ast/src/converter/rdf_to_shacl/shacl_parser.rs index a3d27ed9..aba6a38b 100644 --- a/shacl_ast/src/converter/rdf_to_shacl/shacl_parser.rs +++ b/shacl_ast/src/converter/rdf_to_shacl/shacl_parser.rs @@ -657,7 +657,7 @@ where { match RDF::term_as_iri(term) { Some(iri) => { - let iri_s = RDF::iri2iri_s(&iri); + let iri_s = RDF::iri2iri_s(iri); match iri_s.as_str() { SH_IRI_STR => Ok(NodeKind::Iri), SH_LITERAL_STR => Ok(NodeKind::Literal), diff --git a/shacl_validation/src/constraints/core/string_based/max_length.rs b/shacl_validation/src/constraints/core/string_based/max_length.rs index a590afa4..36f47243 100644 --- a/shacl_validation/src/constraints/core/string_based/max_length.rs +++ b/shacl_validation/src/constraints/core/string_based/max_length.rs @@ -28,7 +28,7 @@ impl NativeValidator for MaxLength { } else { let string_representation = match S::term_as_string(value_node) { Some(string_representation) => string_representation, - None => S::iri2iri_s(&S::term_as_iri(value_node).unwrap()).to_string(), + None => S::iri2iri_s(S::term_as_iri(value_node).unwrap()).to_string(), }; string_representation.len() > self.max_length() as usize } diff --git a/shacl_validation/src/constraints/core/string_based/min_length.rs b/shacl_validation/src/constraints/core/string_based/min_length.rs index a6a25711..f6e2a854 100644 --- a/shacl_validation/src/constraints/core/string_based/min_length.rs +++ b/shacl_validation/src/constraints/core/string_based/min_length.rs @@ -28,7 +28,7 @@ impl NativeValidator for MinLength { } else { let string_representation = match S::term_as_string(value_node) { Some(string_representation) => string_representation, - None => S::iri2iri_s(&S::term_as_iri(value_node).unwrap()).to_string(), + None => S::iri2iri_s(S::term_as_iri(value_node).unwrap()).to_string(), }; string_representation.len() < self.min_length() as usize } diff --git a/srdf/src/srdf_basic.rs b/srdf/src/srdf_basic.rs index c9c1a0eb..0e0354b1 100644 --- a/srdf/src/srdf_basic.rs +++ b/srdf/src/srdf_basic.rs @@ -52,8 +52,8 @@ pub trait SRDFBasic { } fn term_as_object(term: &Self::Term) -> Object; - fn object_as_term<'a>(obj: &'a Object) -> Self::Term; - fn object_as_subject<'a>(obj: &'a Object) -> Option { + fn object_as_term(obj: &Object) -> Self::Term; + fn object_as_subject(obj: &Object) -> Option { let term = Self::object_as_term(obj); Self::term_as_subject(&term) } @@ -78,7 +78,7 @@ pub trait SRDFBasic { } fn term_as_iri_s(term: &Self::Term) -> Option { - Self::term_as_iri(term).map(|iri| Self::iri2iri_s(&iri)) + Self::term_as_iri(term).map(|iri| Self::iri2iri_s(iri)) } fn term_as_integer(term: &Self::Term) -> Option { diff --git a/srdf/src/srdf_parser/rdf_node_parser.rs b/srdf/src/srdf_parser/rdf_node_parser.rs index 433efe37..9bdd7113 100644 --- a/srdf/src/srdf_parser/rdf_node_parser.rs +++ b/srdf/src/srdf_parser/rdf_node_parser.rs @@ -622,7 +622,7 @@ where None => Err(RDFParseError::ExpectedIRI { term: format!("{t}"), }), - Some(v) => Ok(RDF::iri2iri_s(&v)), + Some(v) => Ok(RDF::iri2iri_s(v)), }) } @@ -709,7 +709,7 @@ where satisfy( |node: &RDF::Term| match RDF::term_as_iri(node) { Some(iri) => { - let iri_s = RDF::iri2iri_s(&iri); + let iri_s = RDF::iri2iri_s(iri); iri_s.as_str() == RDF_NIL_STR } None => false, @@ -1098,7 +1098,7 @@ where let iri = RDF::term_as_iri(term).ok_or_else(|| RDFParseError::ExpectedIRI { term: format!("{term}"), })?; - Ok(RDF::iri2iri_s(&iri)) + Ok(RDF::iri2iri_s(iri)) } fn term_to_string(term: &RDF::Term) -> Result @@ -1359,7 +1359,7 @@ where RDF: SRDF, { if let Some(iri) = RDF::term_as_iri(node) { - RDF::iri2iri_s(&iri) == *RDF_NIL + RDF::iri2iri_s(iri) == *RDF_NIL } else { false } @@ -1374,7 +1374,7 @@ where satisfy( move |node: &RDF::Term| match RDF::term_as_iri(node) { Some(iri) => { - let iri_s = RDF::iri2iri_s(&iri); + let iri_s = RDF::iri2iri_s(iri); iri_s == expected_iri } None => false, @@ -1751,7 +1751,7 @@ where fn parse_impl(&mut self, rdf: &mut RDF) -> PResult { let rdf_type = parse_rdf_type().parse_impl(rdf)?; let iri_type = match RDF::term_as_iri(&rdf_type) { - Some(iri) => RDF::iri2iri_s(&iri), + Some(iri) => RDF::iri2iri_s(iri), None => { return Err(RDFParseError::ExpectedIRI { term: format!("{rdf_type}"),