Skip to content

Commit

Permalink
lint: Run clippy --fix (#506)
Browse files Browse the repository at this point in the history
This fixes warnings appearing in the new version of Rust.
  • Loading branch information
bjchambers authored Jul 13, 2023
2 parents b05855f + 95f823e commit b8317af
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions crates/sparrow-compiler/src/dfg/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ mod tests {
children: Vec::new(),
};

let mut analysis = DfgAnalysis::default();
let mut analysis = DfgAnalysis;
let merge_result = analysis.merge(&mut a, b);
assert!(!merge_result.0);
assert!(!merge_result.1);
Expand Down Expand Up @@ -370,7 +370,7 @@ mod tests {
children: Vec::new(),
};

let mut analysis = DfgAnalysis::default();
let mut analysis = DfgAnalysis;
let merge_result = analysis.merge(&mut a, b);
assert!(!merge_result.0);
assert!(merge_result.1);
Expand Down Expand Up @@ -405,7 +405,7 @@ mod tests {
children: Vec::new(),
};

let mut analysis = DfgAnalysis::default();
let mut analysis = DfgAnalysis;
let merge_result = analysis.merge(&mut a, b);
assert!(merge_result.0);
assert!(!merge_result.1);
Expand Down Expand Up @@ -441,7 +441,7 @@ mod tests {
children: Vec::new(),
};

let mut analysis = DfgAnalysis::default();
let mut analysis = DfgAnalysis;
let merge_result = analysis.merge(&mut a, b);
assert!(merge_result.0);
assert!(!merge_result.1);
Expand Down
10 changes: 5 additions & 5 deletions crates/sparrow-compiler/src/functions/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,27 @@ impl<'building> FunctionBuilder<'building> {
Self(instruction)
}

pub fn set_internal(mut self) -> Self {
pub fn set_internal(self) -> Self {
self.0.internal = true;
self
}

pub fn with_implementation(mut self, implementation: Implementation) -> Self {
pub fn with_implementation(self, implementation: Implementation) -> Self {
self.0.implementation = implementation;
self
}

pub fn with_is_new(mut self, is_new: Implementation) -> Self {
pub fn with_is_new(self, is_new: Implementation) -> Self {
self.0.is_new = is_new;
self
}

pub fn with_time_domain_check(mut self, time_domain_check: TimeDomainCheck) -> Self {
pub fn with_time_domain_check(self, time_domain_check: TimeDomainCheck) -> Self {
self.0.time_domain_check = time_domain_check;
self
}

pub fn with_dfg_signature(mut self, signature_str: &'static str) -> Self {
pub fn with_dfg_signature(self, signature_str: &'static str) -> Self {
let signature =
Signature::try_from_str(FeatureSetPart::Function(signature_str), signature_str)
.unwrap_or_else(|e| panic!("Failed to parse signature '{signature_str}': {e:?}"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn benchmark_serialize(vec: &[i64]) {
}

fn serialize_unsafe(vec: &[i64]) -> &[u8] {
let len = size_of::<i64>() * vec.len();
let len = std::mem::size_of_val(vec);
// SAFETY: `ptr` has valid alignment (came from a vec) and contains `len` bytes.
unsafe {
let ptr = vec.as_ptr();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl<AggF: AggFn> TwoStacks<AggF> {
// Each item should be the sum of its accumulator and the cumulative
// values below it.
let mut accum = AggF::zero();
for mut outgoing in &mut self.outgoing {
for outgoing in &mut self.outgoing {
AggF::merge(&mut accum, &outgoing.accum);
outgoing.cumulative = accum.clone();
}
Expand Down
16 changes: 8 additions & 8 deletions crates/sparrow-instructions/src/evaluators/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -92,7 +92,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -133,7 +133,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -178,7 +178,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -219,7 +219,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -264,7 +264,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -305,7 +305,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -350,7 +350,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
4 changes: 2 additions & 2 deletions crates/sparrow-instructions/src/evaluators/equality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -298,7 +298,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down
10 changes: 5 additions & 5 deletions crates/sparrow-instructions/src/evaluators/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ where
let input = info.unpack_argument()?;
Ok(Box::new(Self {
input,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -88,7 +88,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -122,7 +122,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -156,7 +156,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -214,7 +214,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
2 changes: 1 addition & 1 deletion crates/sparrow-instructions/src/evaluators/math/clamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<T: ArrowNumericType> EvaluatorFactory for ClampEvaluator<T> {
input,
min,
max,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/sparrow-instructions/src/evaluators/math/exp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ where
let input = info.unpack_argument()?;
Ok(Box::new(Self {
input,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/sparrow-instructions/src/evaluators/math/min_max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down Expand Up @@ -59,7 +59,7 @@ where
Ok(Box::new(Self {
lhs,
rhs,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/sparrow-instructions/src/evaluators/math/powf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ where
Ok(Box::new(Self {
base,
exp,
_phantom: PhantomData::default(),
_phantom: PhantomData,
}))
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/sparrow-runtime/src/execute/operation/spread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ impl<T: ArrowPrimitiveType> std::fmt::Debug for UnlatchedPrimitiveSpread<T> {
impl<T: ArrowPrimitiveType> UnlatchedPrimitiveSpread<T> {
fn new() -> Self {
Self {
_phantom: PhantomData::default(),
_phantom: PhantomData,
}
}
}
Expand Down

0 comments on commit b8317af

Please sign in to comment.