Makes the new Clippy happy

pull/216/head
Tpt 2 years ago
parent 61129511d8
commit b04bdcceed
  1. 30
      lib/src/io/format.rs
  2. 4
      lib/src/lib.rs
  3. 174
      lib/src/sparql/plan.rs
  4. 18
      lib/src/storage/binary_encoder.rs

@ -23,9 +23,9 @@ impl GraphFormat {
#[inline]
pub fn iri(self) -> &'static str {
match self {
GraphFormat::NTriples => "http://www.w3.org/ns/formats/N-Triples",
GraphFormat::Turtle => "http://www.w3.org/ns/formats/Turtle",
GraphFormat::RdfXml => "http://www.w3.org/ns/formats/RDF_XML",
Self::NTriples => "http://www.w3.org/ns/formats/N-Triples",
Self::Turtle => "http://www.w3.org/ns/formats/Turtle",
Self::RdfXml => "http://www.w3.org/ns/formats/RDF_XML",
}
}
@ -39,9 +39,9 @@ impl GraphFormat {
#[inline]
pub fn media_type(self) -> &'static str {
match self {
GraphFormat::NTriples => "application/n-triples",
GraphFormat::Turtle => "text/turtle",
GraphFormat::RdfXml => "application/rdf+xml",
Self::NTriples => "application/n-triples",
Self::Turtle => "text/turtle",
Self::RdfXml => "application/rdf+xml",
}
}
@ -55,9 +55,9 @@ impl GraphFormat {
#[inline]
pub fn file_extension(self) -> &'static str {
match self {
GraphFormat::NTriples => "nt",
GraphFormat::Turtle => "ttl",
GraphFormat::RdfXml => "rdf",
Self::NTriples => "nt",
Self::Turtle => "ttl",
Self::RdfXml => "rdf",
}
}
/// Looks for a known format from a media type.
@ -125,8 +125,8 @@ impl DatasetFormat {
#[inline]
pub fn iri(self) -> &'static str {
match self {
DatasetFormat::NQuads => "http://www.w3.org/ns/formats/N-Quads",
DatasetFormat::TriG => "http://www.w3.org/ns/formats/TriG",
Self::NQuads => "http://www.w3.org/ns/formats/N-Quads",
Self::TriG => "http://www.w3.org/ns/formats/TriG",
}
}
@ -140,8 +140,8 @@ impl DatasetFormat {
#[inline]
pub fn media_type(self) -> &'static str {
match self {
DatasetFormat::NQuads => "application/n-quads",
DatasetFormat::TriG => "application/trig",
Self::NQuads => "application/n-quads",
Self::TriG => "application/trig",
}
}
@ -155,8 +155,8 @@ impl DatasetFormat {
#[inline]
pub fn file_extension(self) -> &'static str {
match self {
DatasetFormat::NQuads => "nq",
DatasetFormat::TriG => "trig",
Self::NQuads => "nq",
Self::TriG => "trig",
}
}
/// Looks for a known format from a media type.

@ -75,7 +75,7 @@
clippy::needless_continue,
clippy::needless_pass_by_value,
clippy::non_ascii_literal,
//TODO clippy::nonstandard_macro_braces,
clippy::nonstandard_macro_braces,
//TODO clippy::option_if_let_else,
// clippy::panic, clippy::panic_in_result_fn, does not work well with tests
clippy::path_buf_push_overwrite,
@ -83,7 +83,7 @@
clippy::print_stdout,
clippy::range_minus_one,
clippy::range_plus_one,
//TODO clippy::rc_mutex,
clippy::rc_mutex,
clippy::enum_variant_names,
//TODO clippy::redundant_closure_for_method_calls,
clippy::redundant_else,

@ -461,112 +461,110 @@ pub enum PlanExpression {
impl PlanExpression {
pub fn lookup_used_variables(&self, callback: &mut impl FnMut(usize)) {
match self {
PlanExpression::Variable(v) | PlanExpression::Bound(v) => {
Self::Variable(v) | Self::Bound(v) => {
callback(*v);
}
PlanExpression::Constant(_)
| PlanExpression::Rand
| PlanExpression::Now
| PlanExpression::Uuid
| PlanExpression::StrUuid
| PlanExpression::BNode(None) => (),
PlanExpression::UnaryPlus(e)
| PlanExpression::UnaryMinus(e)
| PlanExpression::Not(e)
| PlanExpression::BNode(Some(e))
| PlanExpression::Str(e)
| PlanExpression::Lang(e)
| PlanExpression::Datatype(e)
| PlanExpression::Iri(e)
| PlanExpression::Abs(e)
| PlanExpression::Ceil(e)
| PlanExpression::Floor(e)
| PlanExpression::Round(e)
| PlanExpression::UCase(e)
| PlanExpression::LCase(e)
| PlanExpression::StrLen(e)
| PlanExpression::EncodeForUri(e)
| PlanExpression::Year(e)
| PlanExpression::Month(e)
| PlanExpression::Day(e)
| PlanExpression::Hours(e)
| PlanExpression::Minutes(e)
| PlanExpression::Seconds(e)
| PlanExpression::Timezone(e)
| PlanExpression::Tz(e)
| PlanExpression::Md5(e)
| PlanExpression::Sha1(e)
| PlanExpression::Sha256(e)
| PlanExpression::Sha384(e)
| PlanExpression::Sha512(e)
| PlanExpression::IsIri(e)
| PlanExpression::IsBlank(e)
| PlanExpression::IsLiteral(e)
| PlanExpression::IsNumeric(e)
| PlanExpression::IsTriple(e)
| PlanExpression::Subject(e)
| PlanExpression::Predicate(e)
| PlanExpression::Object(e)
| PlanExpression::BooleanCast(e)
| PlanExpression::DoubleCast(e)
| PlanExpression::FloatCast(e)
| PlanExpression::DecimalCast(e)
| PlanExpression::IntegerCast(e)
| PlanExpression::DateCast(e)
| PlanExpression::TimeCast(e)
| PlanExpression::DateTimeCast(e)
| PlanExpression::DurationCast(e)
| PlanExpression::YearMonthDurationCast(e)
| PlanExpression::DayTimeDurationCast(e)
| PlanExpression::StringCast(e) => e.lookup_used_variables(callback),
PlanExpression::Or(a, b)
| PlanExpression::And(a, b)
| PlanExpression::Equal(a, b)
| PlanExpression::Greater(a, b)
| PlanExpression::GreaterOrEqual(a, b)
| PlanExpression::Less(a, b)
| PlanExpression::LessOrEqual(a, b)
| PlanExpression::Add(a, b)
| PlanExpression::Subtract(a, b)
| PlanExpression::Multiply(a, b)
| PlanExpression::Divide(a, b)
| PlanExpression::LangMatches(a, b)
| PlanExpression::Contains(a, b)
| PlanExpression::StrStarts(a, b)
| PlanExpression::StrEnds(a, b)
| PlanExpression::StrBefore(a, b)
| PlanExpression::StrAfter(a, b)
| PlanExpression::StrLang(a, b)
| PlanExpression::StrDt(a, b)
| PlanExpression::SameTerm(a, b)
| PlanExpression::SubStr(a, b, None)
| PlanExpression::Regex(a, b, None) => {
Self::Constant(_)
| Self::Rand
| Self::Now
| Self::Uuid
| Self::StrUuid
| Self::BNode(None) => (),
Self::UnaryPlus(e)
| Self::UnaryMinus(e)
| Self::Not(e)
| Self::BNode(Some(e))
| Self::Str(e)
| Self::Lang(e)
| Self::Datatype(e)
| Self::Iri(e)
| Self::Abs(e)
| Self::Ceil(e)
| Self::Floor(e)
| Self::Round(e)
| Self::UCase(e)
| Self::LCase(e)
| Self::StrLen(e)
| Self::EncodeForUri(e)
| Self::Year(e)
| Self::Month(e)
| Self::Day(e)
| Self::Hours(e)
| Self::Minutes(e)
| Self::Seconds(e)
| Self::Timezone(e)
| Self::Tz(e)
| Self::Md5(e)
| Self::Sha1(e)
| Self::Sha256(e)
| Self::Sha384(e)
| Self::Sha512(e)
| Self::IsIri(e)
| Self::IsBlank(e)
| Self::IsLiteral(e)
| Self::IsNumeric(e)
| Self::IsTriple(e)
| Self::Subject(e)
| Self::Predicate(e)
| Self::Object(e)
| Self::BooleanCast(e)
| Self::DoubleCast(e)
| Self::FloatCast(e)
| Self::DecimalCast(e)
| Self::IntegerCast(e)
| Self::DateCast(e)
| Self::TimeCast(e)
| Self::DateTimeCast(e)
| Self::DurationCast(e)
| Self::YearMonthDurationCast(e)
| Self::DayTimeDurationCast(e)
| Self::StringCast(e) => e.lookup_used_variables(callback),
Self::Or(a, b)
| Self::And(a, b)
| Self::Equal(a, b)
| Self::Greater(a, b)
| Self::GreaterOrEqual(a, b)
| Self::Less(a, b)
| Self::LessOrEqual(a, b)
| Self::Add(a, b)
| Self::Subtract(a, b)
| Self::Multiply(a, b)
| Self::Divide(a, b)
| Self::LangMatches(a, b)
| Self::Contains(a, b)
| Self::StrStarts(a, b)
| Self::StrEnds(a, b)
| Self::StrBefore(a, b)
| Self::StrAfter(a, b)
| Self::StrLang(a, b)
| Self::StrDt(a, b)
| Self::SameTerm(a, b)
| Self::SubStr(a, b, None)
| Self::Regex(a, b, None) => {
a.lookup_used_variables(callback);
b.lookup_used_variables(callback);
}
PlanExpression::If(a, b, c)
| PlanExpression::SubStr(a, b, Some(c))
| PlanExpression::Regex(a, b, Some(c))
| PlanExpression::Replace(a, b, c, None)
| PlanExpression::Triple(a, b, c) => {
Self::If(a, b, c)
| Self::SubStr(a, b, Some(c))
| Self::Regex(a, b, Some(c))
| Self::Replace(a, b, c, None)
| Self::Triple(a, b, c) => {
a.lookup_used_variables(callback);
b.lookup_used_variables(callback);
c.lookup_used_variables(callback);
}
PlanExpression::Replace(a, b, c, Some(d)) => {
Self::Replace(a, b, c, Some(d)) => {
a.lookup_used_variables(callback);
b.lookup_used_variables(callback);
c.lookup_used_variables(callback);
d.lookup_used_variables(callback);
}
PlanExpression::Concat(es)
| PlanExpression::Coalesce(es)
| PlanExpression::CustomFunction(_, es) => {
Self::Concat(es) | Self::Coalesce(es) | Self::CustomFunction(_, es) => {
for e in es {
e.lookup_used_variables(callback);
}
}
PlanExpression::Exists(e) => {
Self::Exists(e) => {
e.lookup_used_variables(callback);
}
}

@ -67,15 +67,15 @@ impl QuadEncoding {
pub fn decode(self, buffer: &[u8]) -> Result<EncodedQuad, StorageError> {
let mut cursor = Cursor::new(&buffer);
match self {
QuadEncoding::Spog => cursor.read_spog_quad(),
QuadEncoding::Posg => cursor.read_posg_quad(),
QuadEncoding::Ospg => cursor.read_ospg_quad(),
QuadEncoding::Gspo => cursor.read_gspo_quad(),
QuadEncoding::Gpos => cursor.read_gpos_quad(),
QuadEncoding::Gosp => cursor.read_gosp_quad(),
QuadEncoding::Dspo => cursor.read_dspo_quad(),
QuadEncoding::Dpos => cursor.read_dpos_quad(),
QuadEncoding::Dosp => cursor.read_dosp_quad(),
Self::Spog => cursor.read_spog_quad(),
Self::Posg => cursor.read_posg_quad(),
Self::Ospg => cursor.read_ospg_quad(),
Self::Gspo => cursor.read_gspo_quad(),
Self::Gpos => cursor.read_gpos_quad(),
Self::Gosp => cursor.read_gosp_quad(),
Self::Dspo => cursor.read_dspo_quad(),
Self::Dpos => cursor.read_dpos_quad(),
Self::Dosp => cursor.read_dosp_quad(),
}
}
}

Loading…
Cancel
Save