Makes Clippy 1.65 happy

pull/543/head
Tpt 1 year ago
parent ae294683d6
commit c016116b09
  1. 15
      lib/oxrdf/src/dataset.rs
  2. 2
      lib/oxrdf/src/interning.rs
  3. 2
      lib/spargebra/src/parser.rs
  4. 16
      lib/src/sparql/eval.rs
  5. 2
      lib/src/sparql/plan_builder.rs
  6. 2
      lib/src/storage/backend/fallback.rs
  7. 4
      lib/src/storage/backend/rocksdb.rs

@ -29,6 +29,7 @@
use crate::interning::*;
use crate::SubjectRef;
use crate::*;
use std::cmp::min;
use std::collections::hash_map::DefaultHasher;
use std::collections::BTreeSet;
use std::collections::{HashMap, HashSet};
@ -705,7 +706,7 @@ impl Dataset {
InternedTerm,
InternedGraphName,
)> {
let b_prime = partition.iter().find_map(|(_, b)| (b.len() > 1).then(|| b));
let b_prime = partition.iter().map(|(_, b)| b).find(|b| b.len() > 1);
if let Some(b_prime) = b_prime {
b_prime
.iter()
@ -715,17 +716,7 @@ impl Dataset {
let (hash_prime_prime, partition_prime) = self.hash_bnodes(hash_prime);
self.distinguish(&hash_prime_prime, &partition_prime)
})
.fold(None, |a, b| {
Some(if let Some(a) = a {
if a <= b {
a
} else {
b
}
} else {
b
})
})
.reduce(min)
.unwrap_or_default()
} else {
self.label(hash)

@ -466,7 +466,7 @@ impl InternedTriple {
interner
.triples
.contains_key(&interned_triple)
.then(|| interned_triple)
.then_some(interned_triple)
}
pub fn next(&self) -> Self {

@ -736,7 +736,7 @@ impl ParserState {
let aggregates = self.aggregates.last_mut().ok_or("Unexpected aggregate")?;
Ok(aggregates
.iter()
.find_map(|(v, a)| (a == &agg).then(|| v))
.find_map(|(v, a)| (a == &agg).then_some(v))
.cloned()
.unwrap_or_else(|| {
let new_var = variable();

@ -2321,7 +2321,7 @@ fn to_argument_compatible_strings(
) -> Option<(String, String, Option<SmallStringOrId>)> {
let (value1, language1) = to_string_and_language(dataset, arg1)?;
let (value2, language2) = to_string_and_language(dataset, arg2)?;
(language2.is_none() || language1 == language2).then(|| (value1, value2, language1))
(language2.is_none() || language1 == language2).then_some((value1, value2, language1))
}
pub(super) fn compile_pattern(pattern: &str, flags: Option<&str>) -> Option<Regex> {
@ -3080,10 +3080,10 @@ fn put_pattern_value(
tuple: &mut EncodedTuple,
) -> Option<()> {
match selector {
TupleSelector::Constant(c) => (*c == value).then(|| ()),
TupleSelector::Constant(c) => (*c == value).then_some(()),
TupleSelector::Variable(v) => {
if let Some(old) = tuple.get(*v) {
(value == *old).then(|| ())
(value == *old).then_some(())
} else {
tuple.set(*v, value);
Some(())
@ -3161,7 +3161,7 @@ impl PathEvaluator {
.and_then(|middle| {
Ok(self
.eval_closed_in_graph(b, &middle, end, graph_name)?
.then(|| ()))
.then_some(()))
})
.transpose()
})
@ -3232,7 +3232,7 @@ impl PathEvaluator {
Box::new(self.eval_from_in_unknown_graph(a, start).flat_map_ok(
move |(middle, graph_name)| {
eval.eval_closed_in_graph(&b, &middle, &end, &graph_name)
.map(|is_found| is_found.then(|| graph_name))
.map(|is_found| is_found.then_some(graph_name))
.transpose()
},
))
@ -3252,7 +3252,7 @@ impl PathEvaluator {
|e| eval.eval_from_in_graph(&p, &e, &graph_name),
&end,
)
.map(|is_found| is_found.then(|| graph_name))
.map(|is_found| is_found.then_some(graph_name))
.transpose()
})
}
@ -3269,7 +3269,7 @@ impl PathEvaluator {
|e| eval.eval_from_in_graph(&p, &e, &graph_name),
&end,
)
.map(|is_found| is_found.then(|| graph_name))
.map(|is_found| is_found.then_some(graph_name))
})
.transpose()
}),
@ -3285,7 +3285,7 @@ impl PathEvaluator {
let p = Rc::clone(p);
self.run_if_term_is_a_dataset_node(start, move |graph_name| {
eval.eval_closed_in_graph(&p, &start2, &end, &graph_name)
.map(|is_found| is_found.then(|| graph_name))
.map(|is_found| is_found.then_some(graph_name))
.transpose()
})
}

@ -1223,7 +1223,7 @@ impl<'a> PlanBuilder<'a> {
let encoded = if let Some(to_id) = to
.iter()
.enumerate()
.find_map(|(to_id, var)| (*var == from_variable.plain).then(|| to_id))
.find_map(|(to_id, var)| (*var == from_variable.plain).then_some(to_id))
{
to_id
} else {

@ -32,7 +32,7 @@ impl Db {
#[allow(clippy::unwrap_in_result)]
pub fn column_family(&self, name: &'static str) -> Option<ColumnFamily> {
let name = ColumnFamily(name);
(self.0.read().unwrap().contains_key(&name)).then(|| name)
self.0.read().unwrap().contains_key(&name).then_some(name)
}
#[must_use]

@ -393,7 +393,7 @@ impl Db {
cf_handles,
cf_options,
is_secondary: true,
path_to_remove: in_memory.then(|| secondary_path),
path_to_remove: in_memory.then_some(secondary_path),
})),
})
}
@ -1001,7 +1001,7 @@ impl Reader {
break;
}
}
found.then(|| bound)
found.then_some(bound)
};
unsafe {

Loading…
Cancel
Save