Skip to content

Commit

Permalink
tidy for clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
alecmocatta committed Jul 25, 2019
1 parent b911f52 commit 90e5402
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/distinct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,21 @@ impl<V: Hash> PartialEq for HyperLogLogMagnitude<V> {
impl<V: Hash> Eq for HyperLogLogMagnitude<V> {}
impl<V: Hash> Clone for HyperLogLogMagnitude<V> {
fn clone(&self) -> Self {
HyperLogLogMagnitude(self.0.clone())
Self(self.0.clone())
}
}
impl<V: Hash> New for HyperLogLogMagnitude<V> {
type Config = f64;
fn new(config: &Self::Config) -> Self {
HyperLogLogMagnitude(New::new(config))
Self(New::new(config))
}
}
impl<V: Hash> Intersect for HyperLogLogMagnitude<V> {
fn intersect<'a>(iter: impl Iterator<Item = &'a Self>) -> Option<Self>
where
Self: Sized + 'a,
{
Intersect::intersect(iter.map(|x| &x.0)).map(HyperLogLogMagnitude)
Intersect::intersect(iter.map(|x| &x.0)).map(Self)
}
}
impl<'a, V: Hash> UnionAssign<&'a HyperLogLogMagnitude<V>> for HyperLogLogMagnitude<V> {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
dead_code,
clippy::doc_markdown,
clippy::inline_always,
clippy::stutter,
clippy::module_name_repetitions,
clippy::if_not_else,
clippy::op_ref,
clippy::needless_pass_by_value,
Expand Down
2 changes: 1 addition & 1 deletion src/ordered_linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl<'a> OrderedLinkedListIndex<'a> {
pub struct OrderedLinkedList<T>(LinkedList<T>);
impl<T: Ord> OrderedLinkedList<T> {
pub fn new(cap: usize) -> Self {
OrderedLinkedList(LinkedList::new(cap))
Self(LinkedList::new(cap))
}
fn assert(&self) {
if !cfg!(feature = "assert") {
Expand Down
4 changes: 2 additions & 2 deletions src/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Drop for SampleTotal {
struct FixedCapVec<T>(Vec<T>);
impl<T> FixedCapVec<T> {
fn new(cap: usize) -> Self {
let self_ = FixedCapVec(Vec::with_capacity(cap));
let self_ = Self(Vec::with_capacity(cap));
assert_eq!(self_.capacity(), cap);
self_
}
Expand Down Expand Up @@ -115,7 +115,7 @@ where
<(usize, Vec<T>)>::deserialize(deserializer).map(|(cap, mut vec)| {
vec.reserve_exact(cap - vec.len());
assert_eq!(vec.capacity(), cap);
FixedCapVec(vec)
Self(vec)
})
}
}
Expand Down
9 changes: 4 additions & 5 deletions src/top.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,9 @@ impl<T, C: Eq> Eq for Node<T, C> {}
#[cfg(test)]
mod test {
use super::*;
use distinct::HyperLogLog;
use crate::{distinct::HyperLogLog, traits::IntersectPlusUnionIsPlus};
use rand::{self, Rng, SeedableRng};
use std::time;
use traits::IntersectPlusUnionIsPlus;

#[test]
fn abc() {
Expand Down Expand Up @@ -355,21 +354,21 @@ mod test {
impl<V: Hash> Eq for HLL<V> {}
impl<V: Hash> Clone for HLL<V> {
fn clone(&self) -> Self {
HLL(self.0.clone())
Self(self.0.clone())
}
}
impl<V: Hash> New for HLL<V> {
type Config = f64;
fn new(config: &Self::Config) -> Self {
HLL(New::new(config))
Self(New::new(config))
}
}
impl<V: Hash> Intersect for HLL<V> {
fn intersect<'a>(iter: impl Iterator<Item = &'a Self>) -> Option<Self>
where
Self: Sized + 'a,
{
Intersect::intersect(iter.map(|x| &x.0)).map(HLL)
Intersect::intersect(iter.map(|x| &x.0)).map(Self)
}
}
impl<'a, V: Hash> UnionAssign<&'a HLL<V>> for HLL<V> {
Expand Down

0 comments on commit 90e5402

Please sign in to comment.