Skip to content

Commit

Permalink
Makes Clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Tpt committed Dec 17, 2022
1 parent 14077d6 commit dd43dd3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 24 deletions.
2 changes: 1 addition & 1 deletion testsuite/rdf-star
2 changes: 1 addition & 1 deletion testsuite/rdf-tests
2 changes: 1 addition & 1 deletion testsuite/tests/rio_testsuite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::io::BufReader;
pub fn parse_rdf_test_file(url: &str) -> Result<OwnedDataset, Box<dyn Error>> {
let base = env!("CARGO_MANIFEST_DIR").to_owned() + "/rio-tests";
let read = BufReader::new(
File::open(&url.replace("https://github.com/Tpt/rio/tests", &base))
File::open(url.replace("https://github.com/Tpt/rio/tests", &base))
.map_err(|e| TestEvaluationError::Io(url.to_owned(), e))?,
);
let base_iri = Iri::parse(url.to_owned())?;
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/serd_testsuite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::io::BufReader;
pub fn parse_rdf_test_file(url: &str) -> Result<OwnedDataset, Box<dyn Error>> {
let base = env!("CARGO_MANIFEST_DIR").to_owned() + "/serd-tests";
let read = BufReader::new(
File::open(&url.replace("http://drobilla.net/sw/serd/test", &base))
File::open(url.replace("http://drobilla.net/sw/serd/test", &base))
.map_err(|e| TestEvaluationError::Io(url.to_owned(), e))?,
);
let base_iri = Iri::parse(url.to_owned())?;
Expand Down
34 changes: 14 additions & 20 deletions turtle/src/gtrig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@ mod test {

const OK_TURTLE_ERROR: Result<(), TurtleError> = Ok(());

type OwnedQuad = (OwnedTerm, OwnedTerm, OwnedTerm, Option<OwnedTerm>);

#[test]
fn relative_iri_references() -> Result<(), TurtleError> {
let got = parse_gtrig(
Expand Down Expand Up @@ -889,8 +891,7 @@ mod test {
?s [ ?p ?o1 ] ?o2 .
"#;

let mut got: Vec<(OwnedTerm, OwnedTerm, OwnedTerm, Option<OwnedTerm>)> =
Vec::with_capacity(2);
let mut got: Vec<OwnedQuad> = Vec::with_capacity(2);

GTriGParser::new(
Cursor::new(gtrig),
Expand All @@ -914,9 +915,7 @@ mod test {
Ok(())
}

fn parse_gtrig(
txt: &str,
) -> Result<Vec<(OwnedTerm, OwnedTerm, OwnedTerm, Option<OwnedTerm>)>, TurtleError> {
fn parse_gtrig(txt: &str) -> Result<Vec<OwnedQuad>, TurtleError> {
let mut got = Vec::new();
GTriGParser::new(Cursor::new(txt), None).parse_all(&mut |quad| {
got.push((
Expand All @@ -930,9 +929,7 @@ mod test {
Ok(got)
}

fn parse_gnq(
txt: &str,
) -> Result<Vec<(OwnedTerm, OwnedTerm, OwnedTerm, Option<OwnedTerm>)>, TurtleError> {
fn parse_gnq(txt: &str) -> Result<Vec<OwnedQuad>, TurtleError> {
let mut got = Vec::new();
crate::GeneralizedNQuadsParser::new(Cursor::new(txt)).parse_all(&mut |quad| {
got.push((
Expand Down Expand Up @@ -986,24 +983,21 @@ mod test {
impl<'a> From<&'a OwnedTerm> for GeneralizedTerm<'a> {
fn from(other: &'a OwnedTerm) -> GeneralizedTerm<'a> {
match other {
OwnedTerm::NamedNode(name) => GeneralizedTerm::NamedNode(NamedNode { iri: &name }),
OwnedTerm::BlankNode(ident) => GeneralizedTerm::BlankNode(BlankNode { id: &ident }),
OwnedTerm::NamedNode(iri) => GeneralizedTerm::NamedNode(NamedNode { iri }),
OwnedTerm::BlankNode(id) => GeneralizedTerm::BlankNode(BlankNode { id }),
OwnedTerm::LiteralSimple(value) => {
GeneralizedTerm::Literal(Literal::Simple { value: &value })
GeneralizedTerm::Literal(Literal::Simple { value })
}
OwnedTerm::LiteralLanguage(value, tag) => {
GeneralizedTerm::Literal(Literal::LanguageTaggedString {
value: &value,
language: &tag,
})
OwnedTerm::LiteralLanguage(value, language) => {
GeneralizedTerm::Literal(Literal::LanguageTaggedString { value, language })
}
OwnedTerm::LiteralDatatype(value, datatype) => {
OwnedTerm::LiteralDatatype(value, iri) => {
GeneralizedTerm::Literal(Literal::Typed {
value: &value,
datatype: NamedNode { iri: &datatype },
value,
datatype: NamedNode { iri },
})
}
OwnedTerm::Variable(name) => GeneralizedTerm::Variable(Variable { name: &name }),
OwnedTerm::Variable(name) => GeneralizedTerm::Variable(Variable { name }),
OwnedTerm::Triple(_) => {
unimplemented!()
}
Expand Down

0 comments on commit dd43dd3

Please sign in to comment.