Makes newer Clippy happy

pull/668/head
Tpt 10 months ago committed by Thomas Tanon
parent 261f9c64a5
commit e6d98445e6
  1. 1
      lib/oxrdf/src/dataset.rs
  2. 2
      lib/oxrdfio/src/parser.rs
  3. 75
      lib/oxsdatatypes/src/date_time.rs
  4. 4
      lib/oxttl/src/lexer.rs
  5. 22
      lib/src/sparql/eval.rs
  6. 4
      lib/src/storage/backend/mod.rs

@ -185,6 +185,7 @@ impl Dataset {
.map(move |q| self.decode_spog(q))
}
#[allow(clippy::map_identity)]
fn interned_quads_for_subject(
&self,
subject: &InternedSubject,

@ -1,6 +1,6 @@
//! Utilities to read RDF graphs and datasets.
pub use crate::error::{ParseError, SyntaxError};
pub use crate::error::ParseError;
use crate::format::RdfFormat;
use oxrdf::{BlankNode, GraphName, IriParseError, Quad, Subject, Term, Triple};
#[cfg(feature = "async-tokio")]

@ -420,19 +420,20 @@ impl Time {
#[inline]
#[must_use]
pub fn checked_add_duration(self, rhs: impl Into<Duration>) -> Option<Self> {
DateTime::new(
1972,
12,
31,
self.hour(),
self.minute(),
self.second(),
self.timezone_offset(),
Some(
DateTime::new(
1972,
12,
31,
self.hour(),
self.minute(),
self.second(),
self.timezone_offset(),
)
.ok()?
.checked_add_duration(rhs)?
.into(),
)
.ok()?
.checked_add_duration(rhs)?
.try_into()
.ok()
}
/// [op:subtract-dayTimeDuration-from-time](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-time)
@ -450,38 +451,40 @@ impl Time {
#[inline]
#[must_use]
pub fn checked_sub_duration(self, rhs: impl Into<Duration>) -> Option<Self> {
DateTime::new(
1972,
12,
31,
self.hour(),
self.minute(),
self.second(),
self.timezone_offset(),
Some(
DateTime::new(
1972,
12,
31,
self.hour(),
self.minute(),
self.second(),
self.timezone_offset(),
)
.ok()?
.checked_sub_duration(rhs)?
.into(),
)
.ok()?
.checked_sub_duration(rhs)?
.try_into()
.ok()
}
// [fn:adjust-time-to-timezone](https://www.w3.org/TR/xpath-functions-31/#func-adjust-time-to-timezone)
#[inline]
#[must_use]
pub fn adjust(self, timezone_offset: Option<TimezoneOffset>) -> Option<Self> {
DateTime::new(
1972,
12,
31,
self.hour(),
self.minute(),
self.second(),
self.timezone_offset(),
Some(
DateTime::new(
1972,
12,
31,
self.hour(),
self.minute(),
self.second(),
self.timezone_offset(),
)
.ok()?
.adjust(timezone_offset)?
.into(),
)
.ok()?
.adjust(timezone_offset)?
.try_into()
.ok()
}
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).

@ -350,9 +350,7 @@ impl N3Lexer {
let a = char::from(*data.get(i)?);
i += 1;
let b = char::from(*data.get(i)?);
if !matches!(a, '0'..='9' | 'A'..='F' | 'a'..='f')
|| !matches!(b, '0'..='9' | 'A'..='F' | 'a'..='f')
{
if !a.is_ascii_hexdigit() || !b.is_ascii_hexdigit() {
return Some((i + 1, Err((
i - 2..=i, format!("escapes in IRIs should be % followed by two hexadecimal characters, found '%{a}{b}'")
).into())));

@ -1575,7 +1575,7 @@ impl SimpleEvaluator {
}
})
}
Function::BNode => match parameters.get(0) {
Function::BNode => match parameters.first() {
Some(id) => {
let id =
self.expression_evaluator(id, encoded_variables, stat_children);
@ -2612,7 +2612,7 @@ impl SimpleEvaluator {
Some(Decimal::try_from(value).ok()?.into())
}
EncodedTerm::IntegerLiteral(value) => {
Some(Decimal::try_from(value).ok()?.into())
Some(Decimal::from(value).into())
}
EncodedTerm::DecimalLiteral(value) => Some(value.into()),
EncodedTerm::BooleanLiteral(value) => {
@ -2658,7 +2658,7 @@ impl SimpleEvaluator {
Rc::new(move |tuple| match e(tuple)? {
EncodedTerm::TimeLiteral(value) => Some(value.into()),
EncodedTerm::DateTimeLiteral(value) => {
Some(Time::try_from(value).ok()?.into())
Some(Time::from(value).into())
}
EncodedTerm::SmallStringLiteral(value) => {
parse_time_str(&value)
@ -3250,7 +3250,7 @@ fn equals(a: &EncodedTerm, b: &EncodedTerm) -> Option<bool> {
EncodedTerm::FloatLiteral(b) => Some(a == b),
EncodedTerm::DoubleLiteral(b) => Some(Double::from(*a) == *b),
EncodedTerm::IntegerLiteral(b) => Some(*a == Float::from(*b)),
EncodedTerm::DecimalLiteral(b) => Some(*a == (*b).try_into().ok()?),
EncodedTerm::DecimalLiteral(b) => Some(*a == (*b).into()),
_ if b.is_unknown_typed_literal() => None,
_ => Some(false),
},
@ -3258,7 +3258,7 @@ fn equals(a: &EncodedTerm, b: &EncodedTerm) -> Option<bool> {
EncodedTerm::FloatLiteral(b) => Some(*a == Double::from(*b)),
EncodedTerm::DoubleLiteral(b) => Some(a == b),
EncodedTerm::IntegerLiteral(b) => Some(*a == Double::from(*b)),
EncodedTerm::DecimalLiteral(b) => Some(*a == (*b).try_into().ok()?),
EncodedTerm::DecimalLiteral(b) => Some(*a == (*b).into()),
_ if b.is_unknown_typed_literal() => None,
_ => Some(false),
},
@ -3271,8 +3271,8 @@ fn equals(a: &EncodedTerm, b: &EncodedTerm) -> Option<bool> {
_ => Some(false),
},
EncodedTerm::DecimalLiteral(a) => match b {
EncodedTerm::FloatLiteral(b) => Some(Float::try_from(*a).ok()? == *b),
EncodedTerm::DoubleLiteral(b) => Some(Double::try_from(*a).ok()? == *b),
EncodedTerm::FloatLiteral(b) => Some(Float::from(*a) == *b),
EncodedTerm::DoubleLiteral(b) => Some(Double::from(*a) == *b),
EncodedTerm::IntegerLiteral(b) => Some(*a == Decimal::from(*b)),
EncodedTerm::DecimalLiteral(b) => Some(a == b),
_ if b.is_unknown_typed_literal() => None,
@ -3537,14 +3537,14 @@ fn partial_cmp_literals(
EncodedTerm::FloatLiteral(b) => a.partial_cmp(b),
EncodedTerm::DoubleLiteral(b) => Double::from(*a).partial_cmp(b),
EncodedTerm::IntegerLiteral(b) => a.partial_cmp(&Float::from(*b)),
EncodedTerm::DecimalLiteral(b) => a.partial_cmp(&(*b).try_into().ok()?),
EncodedTerm::DecimalLiteral(b) => a.partial_cmp(&(*b).into()),
_ => None,
},
EncodedTerm::DoubleLiteral(a) => match b {
EncodedTerm::FloatLiteral(b) => a.partial_cmp(&(*b).into()),
EncodedTerm::DoubleLiteral(b) => a.partial_cmp(b),
EncodedTerm::IntegerLiteral(b) => a.partial_cmp(&Double::from(*b)),
EncodedTerm::DecimalLiteral(b) => a.partial_cmp(&(*b).try_into().ok()?),
EncodedTerm::DecimalLiteral(b) => a.partial_cmp(&(*b).into()),
_ => None,
},
EncodedTerm::IntegerLiteral(a) => match b {
@ -3555,8 +3555,8 @@ fn partial_cmp_literals(
_ => None,
},
EncodedTerm::DecimalLiteral(a) => match b {
EncodedTerm::FloatLiteral(b) => Float::try_from(*a).ok()?.partial_cmp(b),
EncodedTerm::DoubleLiteral(b) => Double::try_from(*a).ok()?.partial_cmp(b),
EncodedTerm::FloatLiteral(b) => Float::from(*a).partial_cmp(b),
EncodedTerm::DoubleLiteral(b) => Double::from(*a).partial_cmp(b),
EncodedTerm::IntegerLiteral(b) => a.partial_cmp(&Decimal::from(*b)),
EncodedTerm::DecimalLiteral(b) => a.partial_cmp(b),
_ => None,

@ -4,9 +4,7 @@
#[cfg(target_family = "wasm")]
pub use fallback::{ColumnFamily, ColumnFamilyDefinition, Db, Iter, Reader, Transaction};
#[cfg(not(target_family = "wasm"))]
pub use rocksdb::{
ColumnFamily, ColumnFamilyDefinition, Db, Iter, Reader, SstFileWriter, Transaction,
};
pub use rocksdb::{ColumnFamily, ColumnFamilyDefinition, Db, Iter, Reader, Transaction};
#[cfg(target_family = "wasm")]
mod fallback;

Loading…
Cancel
Save