diff --git a/lib/oxrdf/src/dataset.rs b/lib/oxrdf/src/dataset.rs index eb655dea..f240a33a 100644 --- a/lib/oxrdf/src/dataset.rs +++ b/lib/oxrdf/src/dataset.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, diff --git a/lib/oxrdfio/src/parser.rs b/lib/oxrdfio/src/parser.rs index bc88cfc4..6258ba18 100644 --- a/lib/oxrdfio/src/parser.rs +++ b/lib/oxrdfio/src/parser.rs @@ -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")] diff --git a/lib/oxsdatatypes/src/date_time.rs b/lib/oxsdatatypes/src/date_time.rs index f7c80431..c7a1c16a 100644 --- a/lib/oxsdatatypes/src/date_time.rs +++ b/lib/oxsdatatypes/src/date_time.rs @@ -420,19 +420,20 @@ impl Time { #[inline] #[must_use] pub fn checked_add_duration(self, rhs: impl Into) -> Option { - 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) -> Option { - 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) -> Option { - 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). diff --git a/lib/oxttl/src/lexer.rs b/lib/oxttl/src/lexer.rs index 65dba56e..6dd1d024 100644 --- a/lib/oxttl/src/lexer.rs +++ b/lib/oxttl/src/lexer.rs @@ -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()))); diff --git a/lib/src/sparql/eval.rs b/lib/src/sparql/eval.rs index 6f52228d..2997b83d 100644 --- a/lib/src/sparql/eval.rs +++ b/lib/src/sparql/eval.rs @@ -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 { 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 { 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 { _ => 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, diff --git a/lib/src/storage/backend/mod.rs b/lib/src/storage/backend/mod.rs index 0fea9616..9261fd56 100644 --- a/lib/src/storage/backend/mod.rs +++ b/lib/src/storage/backend/mod.rs @@ -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;