This is an automated email from the ASF dual-hosted git repository. tison pushed a commit to branch codec in repository https://gitbox.apache.org/repos/asf/datasketches-rust.git
commit 1d368929e6efa3ebb810ea3c1cec681d419b578f Author: tison <[email protected]> AuthorDate: Sat Feb 14 00:00:38 2026 +0800 fix: address lint warnings Signed-off-by: tison <[email protected]> --- datasketches/src/bloom/sketch.rs | 5 +++-- datasketches/src/codec/decode.rs | 20 +++++++++++++++++++- datasketches/src/codec/encode.rs | 17 +++++++++++++++++ datasketches/src/codec/family.rs | 18 ++++++++++++++++++ datasketches/src/codec/mod.rs | 4 ++-- datasketches/src/countmin/sketch.rs | 5 +++-- datasketches/src/cpc/sketch.rs | 3 ++- datasketches/src/frequencies/sketch.rs | 3 ++- datasketches/src/hll/array4.rs | 2 +- datasketches/src/hll/array6.rs | 2 +- datasketches/src/hll/array8.rs | 2 +- datasketches/src/hll/hash_set.rs | 2 +- datasketches/src/hll/list.rs | 2 +- datasketches/src/hll/sketch.rs | 3 ++- datasketches/src/tdigest/sketch.rs | 7 ++++--- 15 files changed, 77 insertions(+), 18 deletions(-) diff --git a/datasketches/src/bloom/sketch.rs b/datasketches/src/bloom/sketch.rs index a1a77b0..99c2963 100644 --- a/datasketches/src/bloom/sketch.rs +++ b/datasketches/src/bloom/sketch.rs @@ -15,13 +15,14 @@ // specific language governing permissions and limitations // under the License. +use std::hash::Hash; +use std::hash::Hasher; + use crate::codec::SketchBytes; use crate::codec::SketchSlice; use crate::codec::family::Family; use crate::error::Error; use crate::hash::XxHash64; -use std::hash::Hash; -use std::hash::Hasher; // Serialization constants const PREAMBLE_LONGS_EMPTY: u8 = 3; diff --git a/datasketches/src/codec/decode.rs b/datasketches/src/codec/decode.rs index 52b005e..37c1523 100644 --- a/datasketches/src/codec/decode.rs +++ b/datasketches/src/codec/decode.rs @@ -1,5 +1,23 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + use std::io; -use std::io::{Cursor, Read}; +use std::io::Cursor; +use std::io::Read; /// A wrapper around a byte slice that provides methods for reading various types of data from it. pub struct SketchSlice<'a> { diff --git a/datasketches/src/codec/encode.rs b/datasketches/src/codec/encode.rs index 0f1423f..60e85c8 100644 --- a/datasketches/src/codec/encode.rs +++ b/datasketches/src/codec/encode.rs @@ -1,3 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + /// A simple wrapper around a `Vec<u8>` that provides methods for writing various types of data. pub struct SketchBytes { bytes: Vec<u8>, diff --git a/datasketches/src/codec/family.rs b/datasketches/src/codec/family.rs index c4e17dc..f0d1685 100644 --- a/datasketches/src/codec/family.rs +++ b/datasketches/src/codec/family.rs @@ -1,9 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + use crate::error::Error; /// Defines the various families of sketch and set operation classes. /// /// A family defines a set of classes that share fundamental algorithms and behaviors. The classes /// within a family may still differ by how they are stored and accessed. +#[allow(dead_code)] // min_pre_longs and max_pre_longs are not used yet pub struct Family { /// The byte ID for this family. pub id: u8, diff --git a/datasketches/src/codec/mod.rs b/datasketches/src/codec/mod.rs index 947d228..3c003c6 100644 --- a/datasketches/src/codec/mod.rs +++ b/datasketches/src/codec/mod.rs @@ -18,10 +18,10 @@ //! Codec utilities for datasketches crate. // public common codec utilities for datasketches crate -mod encode; mod decode; -pub use self::encode::SketchBytes; +mod encode; pub use self::decode::SketchSlice; +pub use self::encode::SketchBytes; // private to datasketches crate pub(crate) mod family; diff --git a/datasketches/src/countmin/sketch.rs b/datasketches/src/countmin/sketch.rs index 0d6e192..9de03c0 100644 --- a/datasketches/src/countmin/sketch.rs +++ b/datasketches/src/countmin/sketch.rs @@ -15,6 +15,9 @@ // specific language governing permissions and limitations // under the License. +use std::hash::Hash; +use std::hash::Hasher; + use crate::codec::SketchBytes; use crate::codec::SketchSlice; use crate::codec::family::Family; @@ -28,8 +31,6 @@ use crate::error::Error; use crate::hash::DEFAULT_UPDATE_SEED; use crate::hash::MurmurHash3X64128; use crate::hash::compute_seed_hash; -use std::hash::Hash; -use std::hash::Hasher; const MAX_TABLE_ENTRIES: usize = 1 << 30; diff --git a/datasketches/src/cpc/sketch.rs b/datasketches/src/cpc/sketch.rs index bf12b47..f55953d 100644 --- a/datasketches/src/cpc/sketch.rs +++ b/datasketches/src/cpc/sketch.rs @@ -16,9 +16,10 @@ // under the License. use std::hash::Hash; -use crate::codec::family::Family; + use crate::codec::SketchBytes; use crate::codec::SketchSlice; +use crate::codec::family::Family; use crate::common::NumStdDev; use crate::common::canonical_double; use crate::common::inv_pow2_table::INVERSE_POWERS_OF_2; diff --git a/datasketches/src/frequencies/sketch.rs b/datasketches/src/frequencies/sketch.rs index 831dab5..b49b391 100644 --- a/datasketches/src/frequencies/sketch.rs +++ b/datasketches/src/frequencies/sketch.rs @@ -17,13 +17,14 @@ //! Frequent items sketch implementations. +use std::hash::Hash; + use crate::codec::SketchBytes; use crate::codec::SketchSlice; use crate::codec::family::Family; use crate::error::Error; use crate::frequencies::reverse_purge_item_hash_map::ReversePurgeItemHashMap; use crate::frequencies::serialization::*; -use std::hash::Hash; type CountSerializeSize<T> = fn(&[T]) -> usize; type SerializeItems<T> = fn(&mut SketchBytes, &[T]); diff --git a/datasketches/src/hll/array4.rs b/datasketches/src/hll/array4.rs index 01367d5..a17b4da 100644 --- a/datasketches/src/hll/array4.rs +++ b/datasketches/src/hll/array4.rs @@ -20,10 +20,10 @@ //! Array4 stores HLL register values using 4 bits per slot (2 slots per byte). //! When values exceed 4 bits after cur_min offset, they're stored in an auxiliary hash map. -use crate::codec::family::Family; use super::aux_map::AuxMap; use crate::codec::SketchBytes; use crate::codec::SketchSlice; +use crate::codec::family::Family; use crate::common::NumStdDev; use crate::error::Error; use crate::hll::estimator::HipEstimator; diff --git a/datasketches/src/hll/array6.rs b/datasketches/src/hll/array6.rs index 95d6dae..0bdb6eb 100644 --- a/datasketches/src/hll/array6.rs +++ b/datasketches/src/hll/array6.rs @@ -21,9 +21,9 @@ //! This is sufficient for most HLL use cases without needing exception handling or //! cur_min optimization like Array4. -use crate::codec::family::Family; use crate::codec::SketchBytes; use crate::codec::SketchSlice; +use crate::codec::family::Family; use crate::common::NumStdDev; use crate::error::Error; use crate::hll::estimator::HipEstimator; diff --git a/datasketches/src/hll/array8.rs b/datasketches/src/hll/array8.rs index 402c7ef..00faf16 100644 --- a/datasketches/src/hll/array8.rs +++ b/datasketches/src/hll/array8.rs @@ -20,9 +20,9 @@ //! Array8 is the simplest HLL array implementation, storing one byte per slot. //! This provides the maximum value range (0-255) with no bit-packing complexity. -use crate::codec::family::Family; use crate::codec::SketchBytes; use crate::codec::SketchSlice; +use crate::codec::family::Family; use crate::common::NumStdDev; use crate::error::Error; use crate::hll::estimator::HipEstimator; diff --git a/datasketches/src/hll/hash_set.rs b/datasketches/src/hll/hash_set.rs index 1bfe327..cbe99ff 100644 --- a/datasketches/src/hll/hash_set.rs +++ b/datasketches/src/hll/hash_set.rs @@ -20,9 +20,9 @@ //! Uses open addressing with a custom stride function to handle collisions. //! Provides better performance than List when many coupons are stored. -use crate::codec::family::Family; use crate::codec::SketchBytes; use crate::codec::SketchSlice; +use crate::codec::family::Family; use crate::error::Error; use crate::hll::HllType; use crate::hll::KEY_MASK_26; diff --git a/datasketches/src/hll/list.rs b/datasketches/src/hll/list.rs index 8459e89..6cd92f8 100644 --- a/datasketches/src/hll/list.rs +++ b/datasketches/src/hll/list.rs @@ -20,9 +20,9 @@ //! Provides sequential storage with linear search for duplicates. //! Efficient for small numbers of coupons before transitioning to HashSet. -use crate::codec::family::Family; use crate::codec::SketchBytes; use crate::codec::SketchSlice; +use crate::codec::family::Family; use crate::error::Error; use crate::hll::HllType; use crate::hll::container::COUPON_EMPTY; diff --git a/datasketches/src/hll/sketch.rs b/datasketches/src/hll/sketch.rs index 4c51209..911f2c0 100644 --- a/datasketches/src/hll/sketch.rs +++ b/datasketches/src/hll/sketch.rs @@ -20,6 +20,8 @@ //! This module provides the main [`HllSketch`] struct, which is the primary interface //! for creating and using HLL sketches for cardinality estimation. +use std::hash::Hash; + use crate::codec::SketchSlice; use crate::codec::family::Family; use crate::common::NumStdDev; @@ -36,7 +38,6 @@ use crate::hll::hash_set::HashSet; use crate::hll::list::List; use crate::hll::mode::Mode; use crate::hll::serialization::*; -use std::hash::Hash; /// A HyperLogLog sketch. /// diff --git a/datasketches/src/tdigest/sketch.rs b/datasketches/src/tdigest/sketch.rs index 8a67db9..fde9fbc 100644 --- a/datasketches/src/tdigest/sketch.rs +++ b/datasketches/src/tdigest/sketch.rs @@ -15,14 +15,15 @@ // specific language governing permissions and limitations // under the License. +use std::cmp::Ordering; +use std::convert::identity; +use std::num::NonZeroU64; + use crate::codec::SketchBytes; use crate::codec::SketchSlice; use crate::codec::family::Family; use crate::error::Error; use crate::tdigest::serialization::*; -use std::cmp::Ordering; -use std::convert::identity; -use std::num::NonZeroU64; /// The default value of K if one is not specified. const DEFAULT_K: u16 = 200; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
