diff --git a/lib/src/rio/xml.rs b/lib/src/rio/xml.rs index 963aa398..0f9056cb 100644 --- a/lib/src/rio/xml.rs +++ b/lib/src/rio/xml.rs @@ -292,7 +292,7 @@ impl RdfXmlIterator { None => { return Err(format_err!( "No state in the stack: the XML is not balanced" - )) + )); } }; diff --git a/lib/src/sparql/eval.rs b/lib/src/sparql/eval.rs index 375b6323..0ad56465 100644 --- a/lib/src/sparql/eval.rs +++ b/lib/src/sparql/eval.rs @@ -487,37 +487,37 @@ impl SimpleEvaluator { EncodedTerm::NaiveDate(date) => Some(date.year().into()), EncodedTerm::DateTime(date_time) => Some(date_time.year().into()), EncodedTerm::NaiveDateTime(date_time) => Some(date_time.year().into()), - _ => None + _ => None, }, PlanExpression::Month(e) => match self.eval_expression(e, tuple)? { EncodedTerm::NaiveDate(date) => Some(date.month().into()), EncodedTerm::DateTime(date_time) => Some(date_time.month().into()), EncodedTerm::NaiveDateTime(date_time) => Some(date_time.month().into()), - _ => None + _ => None, }, PlanExpression::Day(e) => match self.eval_expression(e, tuple)? { EncodedTerm::NaiveDate(date) => Some(date.day().into()), EncodedTerm::DateTime(date_time) => Some(date_time.day().into()), EncodedTerm::NaiveDateTime(date_time) => Some(date_time.day().into()), - _ => None + _ => None, }, PlanExpression::Hours(e) => match self.eval_expression(e, tuple)? { EncodedTerm::NaiveTime(time) => Some(time.hour().into()), EncodedTerm::DateTime(date_time) => Some(date_time.hour().into()), EncodedTerm::NaiveDateTime(date_time) => Some(date_time.hour().into()), - _ => None + _ => None, }, PlanExpression::Minutes(e) => match self.eval_expression(e, tuple)? { EncodedTerm::NaiveTime(time) => Some(time.minute().into()), EncodedTerm::DateTime(date_time) => Some(date_time.minute().into()), EncodedTerm::NaiveDateTime(date_time) => Some(date_time.minute().into()), - _ => None + _ => None, }, PlanExpression::Seconds(e) => match self.eval_expression(e, tuple)? { EncodedTerm::NaiveTime(time) => Some(time.second().into()), EncodedTerm::DateTime(date_time) => Some(date_time.second().into()), EncodedTerm::NaiveDateTime(date_time) => Some(date_time.second().into()), - _ => None + _ => None, }, PlanExpression::UUID() => Some(EncodedTerm::NamedNode { iri_id: self @@ -963,26 +963,34 @@ impl SimpleEvaluator { EncodedTerm::DecimalLiteral(b) => a.partial_cmp(&b), _ => None, }, - EncodedTerm::NaiveDate(a) => if let EncodedTerm::NaiveDate(ref b) = b { - a.partial_cmp(b) - } else { - None - }, - EncodedTerm::NaiveTime(a) => if let EncodedTerm::NaiveTime(ref b) = b { - a.partial_cmp(b) - } else { - None - }, - EncodedTerm::DateTime(a) => if let EncodedTerm::DateTime(ref b) = b { - a.partial_cmp(b) - } else { - None - }, - EncodedTerm::NaiveDateTime(a) => if let EncodedTerm::NaiveDateTime(ref b) = b { - a.partial_cmp(b) - } else { - None - }, + EncodedTerm::NaiveDate(a) => { + if let EncodedTerm::NaiveDate(ref b) = b { + a.partial_cmp(b) + } else { + None + } + } + EncodedTerm::NaiveTime(a) => { + if let EncodedTerm::NaiveTime(ref b) = b { + a.partial_cmp(b) + } else { + None + } + } + EncodedTerm::DateTime(a) => { + if let EncodedTerm::DateTime(ref b) = b { + a.partial_cmp(b) + } else { + None + } + } + EncodedTerm::NaiveDateTime(a) => { + if let EncodedTerm::NaiveDateTime(ref b) = b { + a.partial_cmp(b) + } else { + None + } + } _ => None, } } diff --git a/lib/src/sparql/plan.rs b/lib/src/sparql/plan.rs index fc3e506f..0eee15a1 100644 --- a/lib/src/sparql/plan.rs +++ b/lib/src/sparql/plan.rs @@ -720,10 +720,10 @@ impl<'a, S: EncodedQuadsStore> PlanBuilder<'a, S> { "integer", )? } else if *name == *xsd::DATE { - self.build_cast(parameters, PlanExpression::DateCast, variables, "date")? - } else if *name == *xsd::TIME { - self.build_cast(parameters, PlanExpression::TimeCast, variables, "time")? - } else if *name == *xsd::DATE_TIME { + self.build_cast(parameters, PlanExpression::DateCast, variables, "date")? + } else if *name == *xsd::TIME { + self.build_cast(parameters, PlanExpression::TimeCast, variables, "time")? + } else if *name == *xsd::DATE_TIME { self.build_cast( parameters, PlanExpression::DateTimeCast, diff --git a/lib/src/sparql/xml_results.rs b/lib/src/sparql/xml_results.rs index 7a24837e..3fa30816 100644 --- a/lib/src/sparql/xml_results.rs +++ b/lib/src/sparql/xml_results.rs @@ -104,7 +104,7 @@ pub fn write_xml_results(results: QueryResult<'_>, sink: W) -> Result< QueryResult::Graph(_) => { return Err(format_err!( "Graphs could not be formatted to SPARQL query results XML format" - )) + )); } } Ok(writer.into_inner()) @@ -310,7 +310,7 @@ impl Iterator for ResultsIterator { None => { return Some(Err(format_err!( "No name attribute found for the tag" - ))) + ))); } } state = State::Binding; @@ -386,7 +386,7 @@ impl Iterator for ResultsIterator { return Some(Err(format_err!( "Unexpected textual value found: {}", self.reader.decode(&data) - ))) + ))); } }, Err(error) => return Some(Err(error.into())), @@ -403,7 +403,7 @@ impl Iterator for ResultsIterator { return Some(Err(format_err!( "No variable found for variable {}", self.reader.decode(&var) - ))) + ))); } _ => return Some(Err(format_err!("No name found for tag"))), } diff --git a/lib/src/store/numeric_encoder.rs b/lib/src/store/numeric_encoder.rs index e09d417c..fb927f71 100644 --- a/lib/src/store/numeric_encoder.rs +++ b/lib/src/store/numeric_encoder.rs @@ -427,7 +427,8 @@ impl TermReader for R { NaiveTime::from_num_seconds_from_midnight_opt( self.read_u32::()?, self.read_u32::()?, - ).ok_or_else(|| format_err!("Invalid time serialization"))?, + ) + .ok_or_else(|| format_err!("Invalid time serialization"))?, )), TYPE_DATE_TIME_LITERAL => Ok(EncodedTerm::DateTime(DateTime::from_utc( NaiveDateTime::from_timestamp_opt( diff --git a/lib/tests/rdf_test_cases.rs b/lib/tests/rdf_test_cases.rs index 2d520740..5214d1ed 100644 --- a/lib/tests/rdf_test_cases.rs +++ b/lib/tests/rdf_test_cases.rs @@ -388,7 +388,7 @@ impl<'a> Iterator for TestManifest<'a> { return Some(Err(format_err!( "Invalid tests list. Got term {}", term - ))) + ))); } None => (), } diff --git a/lib/tests/sparql_test_cases.rs b/lib/tests/sparql_test_cases.rs index 75c264c2..8f1fcafd 100644 --- a/lib/tests/sparql_test_cases.rs +++ b/lib/tests/sparql_test_cases.rs @@ -591,7 +591,7 @@ impl<'a> Iterator for TestManifest<'a> { return Some(Err(format_err!( "action not found for test {}", test_subject - ))) + ))); } }; let result = match self