diff --git a/lib/sparesults/src/solution.rs b/lib/sparesults/src/solution.rs index d3dfa9a6..c8036e95 100644 --- a/lib/sparesults/src/solution.rs +++ b/lib/sparesults/src/solution.rs @@ -35,9 +35,7 @@ impl QuerySolution { /// ``` #[inline] pub fn get(&self, index: impl VariableSolutionIndex) -> Option<&Term> { - self.values - .get(index.index(self)?) - .and_then(std::option::Option::as_ref) + self.values.get(index.index(self)?).and_then(Option::as_ref) } /// The number of variables which could be bound. diff --git a/lib/sparesults/src/xml.rs b/lib/sparesults/src/xml.rs index e61d76a1..04583b19 100644 --- a/lib/sparesults/src/xml.rs +++ b/lib/sparesults/src/xml.rs @@ -205,7 +205,7 @@ impl XmlQueryResultsReader { State::Head => { if event.name() == b"variable" { let name = event.attributes() - .filter_map(std::result::Result::ok) + .filter_map(Result::ok) .find(|attr| attr.key == b"name") .ok_or_else(|| SyntaxError::msg("No name attribute found for the tag"))? .unescape_and_decode_value(&reader)?; @@ -345,7 +345,7 @@ impl XmlSolutionsReader { if event.name() == b"binding" { match event .attributes() - .filter_map(std::result::Result::ok) + .filter_map(Result::ok) .find(|attr| attr.key == b"name") { Some(attr) => current_var = Some(attr.unescaped_value()?.to_vec()), diff --git a/lib/spargebra/src/query.rs b/lib/spargebra/src/query.rs index 48ce2394..bd5f6fd9 100644 --- a/lib/spargebra/src/query.rs +++ b/lib/spargebra/src/query.rs @@ -14,7 +14,7 @@ use std::str::FromStr; /// let query = Query::parse(query_str, None)?; /// assert_eq!(query.to_string(), query_str); /// assert_eq!(query.to_sse(), "(project (?s ?p ?o) (bgp (triple ?s ?p ?o)))"); -/// # Result::Ok::<_, spargebra::ParseError>(()) +/// # Ok::<_, spargebra::ParseError>(()) /// ``` #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub enum Query { diff --git a/lib/spargebra/src/update.rs b/lib/spargebra/src/update.rs index cf44f083..8934b134 100644 --- a/lib/spargebra/src/update.rs +++ b/lib/spargebra/src/update.rs @@ -14,7 +14,7 @@ use std::str::FromStr; /// let update = Update::parse(update_str, None)?; /// assert_eq!(update.to_string().trim(), update_str); /// assert_eq!(update.to_sse(), "(update (clear all))"); -/// # Result::Ok::<_, spargebra::ParseError>(()) +/// # Ok::<_, spargebra::ParseError>(()) /// ``` #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct Update { diff --git a/lib/src/sparql/algebra.rs b/lib/src/sparql/algebra.rs index 615ff366..e84f55a9 100644 --- a/lib/src/sparql/algebra.rs +++ b/lib/src/sparql/algebra.rs @@ -24,7 +24,7 @@ use std::str::FromStr; /// let default = vec![NamedNode::new("http://example.com")?.into()]; /// query.dataset_mut().set_default_graph(default.clone()); /// assert_eq!(query.dataset().default_graph_graphs(), Some(default.as_slice())); -/// # Result::Ok::<_, Box>(()) +/// # Ok::<_, Box>(()) /// ``` #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct Query { @@ -97,7 +97,7 @@ impl<'a> TryFrom<&'a String> for Query { /// let update = Update::parse(update_str, None)?; /// /// assert_eq!(update.to_string().trim(), update_str); -/// # Result::Ok::<_, oxigraph::sparql::ParseError>(()) +/// # Ok::<_, oxigraph::sparql::ParseError>(()) /// ``` #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct Update { @@ -127,16 +127,12 @@ impl Update { /// Returns [the query dataset specification](https://www.w3.org/TR/sparql11-query/#specifyingDataset) in [DELETE/INSERT operations](https://www.w3.org/TR/sparql11-update/#deleteInsert). pub fn using_datasets(&self) -> impl Iterator { - self.using_datasets - .iter() - .filter_map(std::option::Option::as_ref) + self.using_datasets.iter().filter_map(Option::as_ref) } /// Returns [the query dataset specification](https://www.w3.org/TR/sparql11-query/#specifyingDataset) in [DELETE/INSERT operations](https://www.w3.org/TR/sparql11-update/#deleteInsert). pub fn using_datasets_mut(&mut self) -> impl Iterator { - self.using_datasets - .iter_mut() - .filter_map(std::option::Option::as_mut) + self.using_datasets.iter_mut().filter_map(Option::as_mut) } } @@ -211,7 +207,7 @@ impl QueryDataset { /// assert!(Query::parse("SELECT ?s ?p ?o WHERE { ?s ?p ?o . }", None)?.dataset().is_default_dataset()); /// assert!(!Query::parse("SELECT ?s ?p ?o FROM WHERE { ?s ?p ?o . }", None)?.dataset().is_default_dataset()); /// - /// # Result::Ok::<_, Box>(()) + /// # Ok::<_, Box>(()) /// ``` pub fn is_default_dataset(&self) -> bool { self.default @@ -243,7 +239,7 @@ impl QueryDataset { /// query.dataset_mut().set_default_graph(default.clone()); /// assert_eq!(query.dataset().default_graph_graphs(), Some(default.as_slice())); /// - /// # Result::Ok::<_, Box>(()) + /// # Ok::<_, Box>(()) /// ``` pub fn set_default_graph(&mut self, graphs: Vec) { self.default = Some(graphs) @@ -265,7 +261,7 @@ impl QueryDataset { /// query.dataset_mut().set_available_named_graphs(named.clone()); /// assert_eq!(query.dataset().available_named_graphs(), Some(named.as_slice())); /// - /// # Result::Ok::<_, Box>(()) + /// # Ok::<_, Box>(()) /// ``` pub fn set_available_named_graphs(&mut self, named_graphs: Vec) { self.named = Some(named_graphs); diff --git a/lib/src/sparql/eval.rs b/lib/src/sparql/eval.rs index 98486cdd..4f2d031c 100644 --- a/lib/src/sparql/eval.rs +++ b/lib/src/sparql/eval.rs @@ -345,9 +345,7 @@ impl SimpleEvaluator { let right = self.plan_evaluator(right); if join_keys.is_empty() { Rc::new(move |from| { - let right: Vec<_> = right(from.clone()) - .filter_map(std::result::Result::ok) - .collect(); + let right: Vec<_> = right(from.clone()).filter_map(Result::ok).collect(); Box::new(left(from).filter(move |left_tuple| { if let Ok(left_tuple) = left_tuple { !right.iter().any(|right_tuple| { @@ -361,8 +359,7 @@ impl SimpleEvaluator { } else { Rc::new(move |from| { let mut right_values = EncodedTupleSet::new(join_keys.clone()); - right_values - .extend(right(from.clone()).filter_map(std::result::Result::ok)); + right_values.extend(right(from.clone()).filter_map(Result::ok)); Box::new(left(from).filter(move |left_tuple| { if let Ok(left_tuple) = left_tuple { !right_values.get(left_tuple).iter().any(|right_tuple| { diff --git a/lib/src/sparql/mod.rs b/lib/src/sparql/mod.rs index 7bbf82fd..1d7680f5 100644 --- a/lib/src/sparql/mod.rs +++ b/lib/src/sparql/mod.rs @@ -37,7 +37,7 @@ pub(crate) fn evaluate_query( query: impl TryInto>, options: QueryOptions, ) -> Result { - let query = query.try_into().map_err(std::convert::Into::into)?; + let query = query.try_into().map_err(Into::into)?; let dataset = DatasetView::new(reader, &query.dataset); match query.inner { spargebra::Query::Select { diff --git a/lib/src/store.rs b/lib/src/store.rs index ae1a8591..54a451c5 100644 --- a/lib/src/store.rs +++ b/lib/src/store.rs @@ -357,7 +357,7 @@ impl Store { update: impl TryInto>, options: impl Into, ) -> Result<(), EvaluationError> { - let update = update.try_into().map_err(std::convert::Into::into)?; + let update = update.try_into().map_err(Into::into)?; let options = options.into(); self.storage .transaction(|mut t| evaluate_update(&mut t, &update, &options)) @@ -968,7 +968,7 @@ impl<'a> Transaction<'a> { ) -> Result<(), EvaluationError> { evaluate_update( &mut self.writer, - &update.try_into().map_err(std::convert::Into::into)?, + &update.try_into().map_err(Into::into)?, &options.into(), ) } diff --git a/server/src/main.rs b/server/src/main.rs index 0edccbf3..d4149b6c 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -61,7 +61,7 @@ enum Command { }, } -pub fn main() -> std::io::Result<()> { +pub fn main() -> io::Result<()> { let matches = Args::parse(); let store = if let Some(path) = &matches.location { Store::open(path) @@ -139,7 +139,7 @@ pub fn main() -> std::io::Result<()> { } fn bulk_load(loader: BulkLoader, file: &str, reader: impl Read) -> io::Result<()> { - let (_, extension) = file.rsplit_once('.').ok_or_else(|| io::Error::new( + let (_, extension) = file.rsplit_once('.').ok_or_else(|| Error::new( ErrorKind::InvalidInput, format!("The server is not able to guess the file format of {} because the file name as no extension", file)))?; let reader = BufReader::new(reader); @@ -150,7 +150,7 @@ fn bulk_load(loader: BulkLoader, file: &str, reader: impl Read) -> io::Result<() loader.load_graph(reader, format, GraphNameRef::DefaultGraph, None)?; Ok(()) } else { - Err(io::Error::new( + Err(Error::new( ErrorKind::InvalidInput, format!( "The server is not able to guess the file format from the extension {}", @@ -1002,16 +1002,16 @@ fn internal_server_error(message: impl fmt::Display) -> Response { } /// Hacky tool to allow implementing read on top of a write loop -struct ReadForWrite std::io::Result>)> { +struct ReadForWrite io::Result>)> { buffer: Rc>>, position: usize, add_more_data: U, state: Option, } -impl std::io::Result>) + 'static> ReadForWrite { +impl io::Result>) + 'static> ReadForWrite { fn build_response( - initial_state_builder: impl FnOnce(ReadForWriteWriter) -> std::io::Result, + initial_state_builder: impl FnOnce(ReadForWriteWriter) -> io::Result, add_more_data: U, content_type: &'static str, ) -> Response { @@ -1033,8 +1033,8 @@ impl std::io::Result>) + 'static> ReadForWrit } } -impl std::io::Result>)> Read for ReadForWrite { - fn read(&mut self, buf: &mut [u8]) -> std::io::Result { +impl io::Result>)> Read for ReadForWrite { + fn read(&mut self, buf: &mut [u8]) -> io::Result { while self.position == self.buffer.borrow().len() { // We read more data if let Some(state) = self.state.take() { @@ -1067,15 +1067,15 @@ struct ReadForWriteWriter { } impl Write for ReadForWriteWriter { - fn write(&mut self, buf: &[u8]) -> std::io::Result { + fn write(&mut self, buf: &[u8]) -> io::Result { self.buffer.borrow_mut().write(buf) } - fn flush(&mut self) -> std::io::Result<()> { + fn flush(&mut self) -> io::Result<()> { Ok(()) } - fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> { + fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { self.buffer.borrow_mut().write_all(buf) } }