diff --git a/src/model/data.rs b/src/model/data.rs index f8774a4e..854d1ca2 100644 --- a/src/model/data.rs +++ b/src/model/data.rs @@ -1,13 +1,13 @@ ///! Implements data structures for https://www.w3.org/TR/rdf11-concepts/ ///! Inspired by [RDFjs](http://rdf.js.org/) use std::fmt; +use std::ops::Deref; use std::option::Option; use std::str::FromStr; use std::sync::Arc; use url::ParseError; use url::Url; use uuid::Uuid; -use std::ops::Deref; /// A RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri) #[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Clone, Hash)] @@ -77,9 +77,7 @@ impl fmt::Display for BlankNode { impl Default for BlankNode { /// Builds a new RDF [blank node](https://www.w3.org/TR/rdf11-concepts/#dfn-blank-node) with a unique id fn default() -> Self { - BlankNode { - id: Uuid::new_v4() - } + BlankNode { id: Uuid::new_v4() } } } diff --git a/src/rio/ntriples/mod.rs b/src/rio/ntriples/mod.rs index bdc8e26e..68a7a273 100644 --- a/src/rio/ntriples/mod.rs +++ b/src/rio/ntriples/mod.rs @@ -6,20 +6,20 @@ mod grammar { use model::data::*; use rio::*; +use std::collections::BTreeMap; use std::io::BufRead; use std::io::BufReader; use std::io::Read; -use std::collections::BTreeMap; pub fn read_ntriples<'a, R: Read + 'a>(source: R) -> impl Iterator> { //TODO: use read_lines to avoid allocations let lines = BufReader::new(source).lines(); let mut bnodes_map: BTreeMap = BTreeMap::default(); lines.flat_map(move |line| match line { - Ok(line) => match grammar::triple(line.as_str(), &mut bnodes_map) { - Ok(triple) => Some(Ok(triple?)), - Err(error) => Some(Err(RioError::new(error))), - }, - Err(error) => Some(Err(error.into())), - }) + Ok(line) => match grammar::triple(line.as_str(), &mut bnodes_map) { + Ok(triple) => Some(Ok(triple?)), + Err(error) => Some(Err(RioError::new(error))), + }, + Err(error) => Some(Err(error.into())), + }) } diff --git a/src/rio/turtle/mod.rs b/src/rio/turtle/mod.rs index 45e23ca4..0b772340 100644 --- a/src/rio/turtle/mod.rs +++ b/src/rio/turtle/mod.rs @@ -5,19 +5,19 @@ mod grammar { use model::data::*; use rio::*; + use std::collections::BTreeMap; use std::collections::HashMap; use std::io::BufReader; use std::io::Read; use url::ParseOptions; use url::Url; - use std::collections::BTreeMap; pub struct ParserState { base_uri: Option, namespaces: HashMap, cur_subject: Vec, cur_predicate: Vec, - bnodes_map: BTreeMap + bnodes_map: BTreeMap, } impl ParserState { @@ -35,7 +35,7 @@ mod grammar { namespaces: HashMap::default(), cur_subject: Vec::default(), cur_predicate: Vec::default(), - bnodes_map: BTreeMap::default() + bnodes_map: BTreeMap::default(), }; let mut triple_buffer = Vec::default(); @@ -49,4 +49,4 @@ mod grammar { } } -pub use self::grammar::read_turtle; \ No newline at end of file +pub use self::grammar::read_turtle;