Skip to content

Commit

Permalink
minor refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
pchampin committed Jul 19, 2023
1 parent 4be75ae commit 3ac5559
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
22 changes: 5 additions & 17 deletions isomorphism/src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,13 @@ where
}

fn prepare_dataset<D: Dataset>(d: &D) -> Result<PreparedDataset<D>, D::Error> {
let mut err = None;
let ret: Vec<_> = d
d
.quads()
.filter_map(|q| {
let q = match q {
Err(e) => {
err = Some(e);
return None;
}
Ok(q) => q,
};
.map(|res| res.map(|q| {
let (spo, g) = q.to_spog();
Some((spo.map(IsoTerm), g.map(IsoTerm)))
})
.collect();
match err {
None => Ok(ret),
Some(e) => Err(e),
}
(spo.map(IsoTerm), g.map(IsoTerm))
}))
.collect()
}

type PreparedDataset<'a, D> = Vec<Spog<IsoTerm<DTerm<'a, D>>>>;
Expand Down
5 changes: 2 additions & 3 deletions turtle/src/serializer/_pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,8 @@ impl<'a, W: Write> Prettifier<'a, W> {
if rdf::nil == iri {
return self.write_bytes(b"()");
}
let iri = match Iri::new(iri.as_str()).ok() {
None => return write!(self.write, "<{}>", iri.as_str()),
Some(iri) => iri,
let Some(iri) = Iri::new(iri.as_str()).ok() else {
return write!(self.write, "<{}>", iri.as_str())
};
match self
.config
Expand Down

0 comments on commit 3ac5559

Please sign in to comment.