Skip to content

Commit

Permalink
Clippied
Browse files Browse the repository at this point in the history
  • Loading branch information
labra committed Oct 30, 2024
1 parent 25b738d commit 4c45590
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion shacl_ast/src/converter/rdf_to_shacl/shacl_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<S: SRDF + Debug + 'static> NativeValidator<S> 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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<S: SRDF + Debug + 'static> NativeValidator<S> 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
}
Expand Down
6 changes: 3 additions & 3 deletions srdf/src/srdf_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self::Subject> {
fn object_as_term(obj: &Object) -> Self::Term;
fn object_as_subject(obj: &Object) -> Option<Self::Subject> {
let term = Self::object_as_term(obj);
Self::term_as_subject(&term)
}
Expand All @@ -78,7 +78,7 @@ pub trait SRDFBasic {
}

fn term_as_iri_s(term: &Self::Term) -> Option<IriS> {
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<isize> {
Expand Down
12 changes: 6 additions & 6 deletions srdf/src/srdf_parser/rdf_node_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
})
}

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<RDF>(term: &RDF::Term) -> Result<String, RDFParseError>
Expand Down Expand Up @@ -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
}
Expand All @@ -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,
Expand Down Expand Up @@ -1751,7 +1751,7 @@ where
fn parse_impl(&mut self, rdf: &mut RDF) -> PResult<Self::Output> {
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}"),
Expand Down

0 comments on commit 4c45590

Please sign in to comment.