From f5a7615145e0e0d5cd8ec9d59dea96482e23fd27 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Mar 2026 04:21:15 +0000 Subject: [PATCH 1/4] Initial plan From 7ed1af1fc155eda5f9fbcb6fb15d1531336ba37c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Mar 2026 04:26:28 +0000 Subject: [PATCH 2/4] Enable clippy::use_self and apply minimal Self fixes Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com> Agent-Logs-Url: https://github.com/fast-pack/FastPFOR-rs/sessions/3a614bfa-875a-4676-809a-0458acd944f8 --- Cargo.toml | 1 + fuzz/Cargo.toml | 1 + src/rust/integer_compression/fastpfor.rs | 2 +- src/rust/integer_compression/just_copy.rs | 4 ++-- src/rust/integer_compression/variable_byte.rs | 10 +++++----- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9175594..ed5c0c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,6 +53,7 @@ missing_docs = "warn" [lints.clippy] cargo = { level = "warn", priority = -1 } pedantic = { level = "warn", priority = -1 } +use_self = "warn" cast_possible_truncation = "allow" cast_possible_wrap = "allow" cast_sign_loss = "allow" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index cec0a38..69e9628 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -22,6 +22,7 @@ unused_qualifications = "warn" [lints.clippy] cargo = { level = "warn", priority = -1 } pedantic = { level = "warn", priority = -1 } +use_self = "warn" # Allow certain lints that are common in fuzz targets and not worth fixing. doc_markdown = "allow" wildcard_imports = "allow" diff --git a/src/rust/integer_compression/fastpfor.rs b/src/rust/integer_compression/fastpfor.rs index c8ef8af..fa6f6bc 100644 --- a/src/rust/integer_compression/fastpfor.rs +++ b/src/rust/integer_compression/fastpfor.rs @@ -93,7 +93,7 @@ impl FastPFor { block_size: N as u32, }); } - Ok(FastPFor { + Ok(Self { bytes_container: BytesMut::with_capacity( (3 * page_size / N as u32 + page_size) as usize, ), diff --git a/src/rust/integer_compression/just_copy.rs b/src/rust/integer_compression/just_copy.rs index ba911f0..9f776aa 100644 --- a/src/rust/integer_compression/just_copy.rs +++ b/src/rust/integer_compression/just_copy.rs @@ -12,13 +12,13 @@ impl JustCopy { /// Creates a new instance #[must_use] pub fn new() -> Self { - JustCopy + Self } } impl Default for JustCopy { fn default() -> Self { - JustCopy::new() + Self::new() } } diff --git a/src/rust/integer_compression/variable_byte.rs b/src/rust/integer_compression/variable_byte.rs index 4550d04..a9f18b5 100644 --- a/src/rust/integer_compression/variable_byte.rs +++ b/src/rust/integer_compression/variable_byte.rs @@ -28,8 +28,8 @@ impl VariableByte { impl VariableByte { /// Creates a new instance #[must_use] - pub fn new() -> VariableByte { - VariableByte + pub fn new() -> Self { + Self } /// Compress `input_length` u32 values from `input[input_offset..]` into @@ -303,7 +303,7 @@ impl VariableByte { impl Default for VariableByte { fn default() -> Self { - VariableByte::new() + Self::new() } } @@ -314,7 +314,7 @@ impl AnyLenCodec for VariableByte { out.resize(start + capacity, 0); let mut in_off = Cursor::new(0u32); let mut out_off = Cursor::new(0u32); - VariableByte::compress_into_slice( + Self::compress_into_slice( input, input.len() as u32, &mut in_off, @@ -342,7 +342,7 @@ impl AnyLenCodec for VariableByte { out.resize(start + capacity, 0); let mut in_off = Cursor::new(0u32); let mut out_off = Cursor::new(0u32); - VariableByte::decompress_from_u32_slice( + Self::decompress_from_u32_slice( input, input.len() as u32, &mut in_off, From 61521f5154b5ac50701713de44779fecf58f19fb Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 25 Mar 2026 00:44:47 -0400 Subject: [PATCH 3/4] Implement Default for JustCopy struct Updated JustCopy struct to implement Default trait using default method. --- src/rust/integer_compression/just_copy.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/rust/integer_compression/just_copy.rs b/src/rust/integer_compression/just_copy.rs index 9f776aa..fef4ca3 100644 --- a/src/rust/integer_compression/just_copy.rs +++ b/src/rust/integer_compression/just_copy.rs @@ -5,20 +5,14 @@ use crate::helpers::AsUsize; /// A no-op codec that copies data without compression. /// /// Useful as a baseline for benchmarking or when a codec interface is required. -#[derive(Debug)] +#[derive(Debug, Default)] pub struct JustCopy; impl JustCopy { /// Creates a new instance #[must_use] pub fn new() -> Self { - Self - } -} - -impl Default for JustCopy { - fn default() -> Self { - Self::new() + Self::default() } } From 66a6b111f7e68232f993e8b0830707a83aa02a7f Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 25 Mar 2026 00:51:09 -0400 Subject: [PATCH 4/4] fix defaults --- src/rust/integer_compression/just_copy.rs | 2 +- src/rust/integer_compression/variable_byte.rs | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/rust/integer_compression/just_copy.rs b/src/rust/integer_compression/just_copy.rs index fef4ca3..767ad11 100644 --- a/src/rust/integer_compression/just_copy.rs +++ b/src/rust/integer_compression/just_copy.rs @@ -12,7 +12,7 @@ impl JustCopy { /// Creates a new instance #[must_use] pub fn new() -> Self { - Self::default() + Self } } diff --git a/src/rust/integer_compression/variable_byte.rs b/src/rust/integer_compression/variable_byte.rs index a9f18b5..8c6b2f2 100644 --- a/src/rust/integer_compression/variable_byte.rs +++ b/src/rust/integer_compression/variable_byte.rs @@ -8,7 +8,7 @@ use crate::rust::cursor::IncrementCursor; use crate::{FastPForError, FastPForResult}; /// Variable-byte encoding codec for integer compression. -#[derive(Debug)] +#[derive(Debug, Default)] pub struct VariableByte; // Helper functions with const generics for extracting 7-bit chunks @@ -301,12 +301,6 @@ impl VariableByte { } } -impl Default for VariableByte { - fn default() -> Self { - Self::new() - } -} - impl AnyLenCodec for VariableByte { fn encode(&mut self, input: &[u32], out: &mut Vec) -> FastPForResult<()> { let capacity = input.len() * 2 + 4;