Makes Clippy happy

pull/171/head
Tpt 4 years ago
parent a2dcbc715a
commit 2067be1a0e
  1. 6
      lib/src/lib.rs
  2. 1
      lib/src/model/dataset.rs
  3. 6
      lib/src/sparql/eval.rs
  4. 1
      lib/src/sparql/service.rs
  5. 2
      testsuite/benches/sparql_query.rs
  6. 8
      testsuite/src/sparql_evaluator.rs

@ -67,7 +67,7 @@
clippy::explicit_iter_loop, clippy::explicit_iter_loop,
clippy::expl_impl_clone_on_copy, clippy::expl_impl_clone_on_copy,
clippy::fallible_impl_from, clippy::fallible_impl_from,
clippy::filter_map, clippy::manual_filter_map,
clippy::filter_map_next, clippy::filter_map_next,
clippy::manual_find_map, clippy::manual_find_map,
clippy::get_unwrap, clippy::get_unwrap,
@ -93,7 +93,6 @@
// clippy::panic, does not work well with tests // clippy::panic, does not work well with tests
clippy::path_buf_push_overwrite, clippy::path_buf_push_overwrite,
clippy::print_stdout, clippy::print_stdout,
clippy::pub_enum_variant_names,
//TODO clippy::redundant_closure_for_method_calls, //TODO clippy::redundant_closure_for_method_calls,
// clippy::shadow_reuse, // clippy::shadow_reuse,
// clippy::shadow_same, // clippy::shadow_same,
@ -107,8 +106,7 @@
clippy::unimplemented, clippy::unimplemented,
clippy::unseparated_literal_suffix, clippy::unseparated_literal_suffix,
clippy::used_underscore_binding, clippy::used_underscore_binding,
clippy::wildcard_dependencies, clippy::wildcard_dependencies
clippy::wrong_pub_self_convention,
)] )]
#![doc(test(attr(deny(warnings))))] #![doc(test(attr(deny(warnings))))]

@ -792,6 +792,7 @@ impl Dataset {
} }
} }
#[allow(clippy::needless_collect)]
fn label( fn label(
&mut self, &mut self,
hashes: &HashMap<InternedBlankNode, u64>, hashes: &HashMap<InternedBlankNode, u64>,

@ -2079,7 +2079,7 @@ impl SimpleEvaluator {
fn partial_cmp(&self, a: &EncodedTerm, b: &EncodedTerm) -> Option<Ordering> { fn partial_cmp(&self, a: &EncodedTerm, b: &EncodedTerm) -> Option<Ordering> {
if a == b { if a == b {
return Some(Ordering::Equal); Some(Ordering::Equal)
} else if let EncodedTerm::Triple(a) = a { } else if let EncodedTerm::Triple(a) = a {
if let EncodedTerm::Triple(b) = b { if let EncodedTerm::Triple(b) = b {
match self.partial_cmp(&a.subject, &b.subject) { match self.partial_cmp(&a.subject, &b.subject) {
@ -2616,7 +2616,7 @@ impl Iterator for BadLeftJoinIterator {
type Item = Result<EncodedTuple, EvaluationError>; type Item = Result<EncodedTuple, EvaluationError>;
fn next(&mut self) -> Option<Result<EncodedTuple, EvaluationError>> { fn next(&mut self) -> Option<Result<EncodedTuple, EvaluationError>> {
while let Some(right_tuple) = self.current_right.next() { for right_tuple in &mut self.current_right {
match right_tuple { match right_tuple {
Ok(right_tuple) => { Ok(right_tuple) => {
if let Some(combined) = combine_tuples( if let Some(combined) = combine_tuples(
@ -2635,7 +2635,7 @@ impl Iterator for BadLeftJoinIterator {
let mut filtered_left = left_tuple.clone(); let mut filtered_left = left_tuple.clone();
unbind_variables(&mut filtered_left, &self.problem_vars); unbind_variables(&mut filtered_left, &self.problem_vars);
self.current_right = self.eval.eval_plan(&self.right_plan, filtered_left); self.current_right = self.eval.eval_plan(&self.right_plan, filtered_left);
while let Some(right_tuple) = self.current_right.next() { for right_tuple in &mut self.current_right {
match right_tuple { match right_tuple {
Ok(right_tuple) => { Ok(right_tuple) => {
if let Some(combined) = if let Some(combined) =

@ -98,7 +98,6 @@ pub struct SimpleServiceHandler {
} }
impl SimpleServiceHandler { impl SimpleServiceHandler {
#[allow(dead_code)]
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
client: Client::new(), client: Client::new(),

@ -28,7 +28,7 @@ fn sparql_w3c_syntax_bench(c: &mut Criterion) {
c.bench_function("query parser", |b| { c.bench_function("query parser", |b| {
b.iter(|| { b.iter(|| {
for (query, base) in &queries { for (query, base) in &queries {
Query::parse(query, Some(&base)).unwrap(); Query::parse(query, Some(base)).unwrap();
} }
}) })
}); });

@ -53,7 +53,7 @@ fn evaluate_positive_syntax_test(test: &Test) -> Result<()> {
.action .action
.as_deref() .as_deref()
.ok_or_else(|| anyhow!("No action found for test {}", test))?; .ok_or_else(|| anyhow!("No action found for test {}", test))?;
match Query::parse(&read_file_to_string(&query_file)?, Some(&query_file)) { match Query::parse(&read_file_to_string(query_file)?, Some(query_file)) {
Err(error) => Err(anyhow!("Not able to parse {} with error: {}", test, error)), Err(error) => Err(anyhow!("Not able to parse {} with error: {}", test, error)),
Ok(query) => match Query::parse(&query.to_string(), None) { Ok(query) => match Query::parse(&query.to_string(), None) {
Ok(_) => Ok(()), Ok(_) => Ok(()),
@ -166,7 +166,7 @@ fn evaluate_positive_update_syntax_test(test: &Test) -> Result<()> {
.action .action
.as_deref() .as_deref()
.ok_or_else(|| anyhow!("No action found for test {}", test))?; .ok_or_else(|| anyhow!("No action found for test {}", test))?;
match Update::parse(&read_file_to_string(&update_file)?, Some(&update_file)) { match Update::parse(&read_file_to_string(update_file)?, Some(update_file)) {
Err(error) => Err(anyhow!("Not able to parse {} with error: {}", test, error)), Err(error) => Err(anyhow!("Not able to parse {} with error: {}", test, error)),
Ok(update) => match Update::parse(&update.to_string(), None) { Ok(update) => match Update::parse(&update.to_string(), None) {
Ok(_) => Ok(()), Ok(_) => Ok(()),
@ -285,7 +285,7 @@ impl StaticServiceHandler {
.map(|(name, data)| { .map(|(name, data)| {
let name = NamedNode::new(name)?; let name = NamedNode::new(name)?;
let store = Store::new()?; let store = Store::new()?;
load_to_store(&data, &store, &GraphName::DefaultGraph)?; load_to_store(data, &store, &GraphName::DefaultGraph)?;
Ok((name, store)) Ok((name, store))
}) })
.collect::<Result<_>>()?, .collect::<Result<_>>()?,
@ -546,7 +546,7 @@ impl StaticQueryResults {
} }
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
bindings.sort_by(|(a, _), (b, _)| a.cmp(&b)); bindings.sort_by(|(a, _), (b, _)| a.cmp(b));
let index = graph let index = graph
.object_for_subject_predicate(solution, rs::INDEX) .object_for_subject_predicate(solution, rs::INDEX)
.and_then(|object| { .and_then(|object| {

Loading…
Cancel
Save