Applies some Clippy suggestions

pull/10/head
Tpt 6 years ago
parent 81cae09eb5
commit 0356de0e40
  1. 6
      lib/src/sparql/eval.rs
  2. 6
      lib/src/sparql/plan.rs
  3. 4
      lib/src/store/numeric_encoder.rs

@ -1056,7 +1056,7 @@ fn put_value(position: usize, value: EncodedTerm, tuple: &mut EncodedTuple) {
} }
fn bind_variables_in_set(binding: &[Option<EncodedTerm>], set: &[usize]) -> Vec<usize> { fn bind_variables_in_set(binding: &[Option<EncodedTerm>], set: &[usize]) -> Vec<usize> {
set.into_iter() set.iter()
.cloned() .cloned()
.filter(|key| *key < binding.len() && binding[*key].is_some()) .filter(|key| *key < binding.len() && binding[*key].is_some())
.collect() .collect()
@ -1073,7 +1073,7 @@ fn unbind_variables(binding: &mut [Option<EncodedTerm>], variables: &[usize]) {
fn combine_tuples(a: &[Option<EncodedTerm>], b: &[Option<EncodedTerm>]) -> Option<EncodedTuple> { fn combine_tuples(a: &[Option<EncodedTerm>], b: &[Option<EncodedTerm>]) -> Option<EncodedTuple> {
if a.len() < b.len() { if a.len() < b.len() {
let mut result = b.to_owned(); let mut result = b.to_owned();
for (key, a_value) in a.into_iter().enumerate() { for (key, a_value) in a.iter().enumerate() {
if let Some(a_value) = a_value { if let Some(a_value) = a_value {
match b[key] { match b[key] {
Some(ref b_value) => { Some(ref b_value) => {
@ -1088,7 +1088,7 @@ fn combine_tuples(a: &[Option<EncodedTerm>], b: &[Option<EncodedTerm>]) -> Optio
Some(result) Some(result)
} else { } else {
let mut result = a.to_owned(); let mut result = a.to_owned();
for (key, b_value) in b.into_iter().enumerate() { for (key, b_value) in b.iter().enumerate() {
if let Some(b_value) = b_value { if let Some(b_value) = b_value {
match a[key] { match a[key] {
Some(ref a_value) => { Some(ref a_value) => {

@ -78,7 +78,7 @@ impl PlanNode {
PlanNode::Init => (), PlanNode::Init => (),
PlanNode::StaticBindings { tuples } => { PlanNode::StaticBindings { tuples } => {
for tuple in tuples { for tuple in tuples {
for (key, value) in tuple.into_iter().enumerate() { for (key, value) in tuple.iter().enumerate() {
if value.is_some() { if value.is_some() {
set.insert(key); set.insert(key);
} }
@ -487,7 +487,7 @@ impl<'a, S: EncodedQuadsStore> PlanBuilder<'a, S> {
}, },
GraphPattern::OrderBy(l, o) => { GraphPattern::OrderBy(l, o) => {
let by: Result<Vec<_>> = o let by: Result<Vec<_>> = o
.into_iter() .iter()
.map(|comp| match comp { .map(|comp| match comp {
OrderComparator::Asc(e) => { OrderComparator::Asc(e) => {
Ok(Comparator::Asc(self.build_for_expression(e, variables)?)) Ok(Comparator::Asc(self.build_for_expression(e, variables)?))
@ -828,7 +828,7 @@ impl<'a, S: EncodedQuadsStore> PlanBuilder<'a, S> {
) -> Result<Vec<TripleTemplate>> { ) -> Result<Vec<TripleTemplate>> {
let mut bnodes = Vec::default(); let mut bnodes = Vec::default();
template template
.into_iter() .iter()
.map(|triple| { .map(|triple| {
Ok(TripleTemplate { Ok(TripleTemplate {
subject: self.template_value_from_term_or_variable( subject: self.template_value_from_term_or_variable(

@ -300,13 +300,13 @@ impl From<f64> for EncodedTerm {
impl From<i32> for EncodedTerm { impl From<i32> for EncodedTerm {
fn from(value: i32) -> Self { fn from(value: i32) -> Self {
EncodedTerm::IntegerLiteral(value as i128) EncodedTerm::IntegerLiteral(value.into())
} }
} }
impl From<u32> for EncodedTerm { impl From<u32> for EncodedTerm {
fn from(value: u32) -> Self { fn from(value: u32) -> Self {
EncodedTerm::IntegerLiteral(value as i128) EncodedTerm::IntegerLiteral(value.into())
} }
} }

Loading…
Cancel
Save