This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 54b5a84a65 refactor(ipc): derive Default for CompressionContext (#9809)
54b5a84a65 is described below

commit 54b5a84a65cfa62b76b25d4d85b97ccd16c056c6
Author: Matt Butrovich <[email protected]>
AuthorDate: Fri Apr 24 18:43:46 2026 -0400

    refactor(ipc): derive Default for CompressionContext (#9809)
    
    # Which issue does this PR close?
    
    Follow-up to #9808.
    
    # Rationale for this change
    
    After #9808 changed the zstd `Compressor` field to `Option`, the manual
    `impl Default` for `CompressionContext` just sets it to `None`, which is
    identical to the derived `Default`. The
    `#[allow(clippy::derivable_impls)]` annotation confirms this was already
    a known issue.
    
    # What changes are included in this PR?
    
    Replace the manual `impl Default for CompressionContext` with
    `#[derive(Default)]` and remove the `clippy::derivable_impls` allow.
    
    # Are these changes tested?
    
    Existing tests cover this. The struct's default behavior is unchanged.
    
    # Are there any user-facing changes?
    
    No.
---
 arrow-ipc/src/compression.rs | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/arrow-ipc/src/compression.rs b/arrow-ipc/src/compression.rs
index f5327fa74f..a4cf99cb86 100644
--- a/arrow-ipc/src/compression.rs
+++ b/arrow-ipc/src/compression.rs
@@ -27,21 +27,12 @@ const LENGTH_OF_PREFIX_DATA: i64 = 8;
 /// In the case of zstd, this will contain the zstd context, which can be 
reused between subsequent
 /// compression calls to avoid the performance overhead of initialising a new 
context for every
 /// compression.
+#[derive(Default)]
 pub struct CompressionContext {
     #[cfg(feature = "zstd")]
     compressor: Option<zstd::bulk::Compressor<'static>>,
 }
 
-#[allow(clippy::derivable_impls)]
-impl Default for CompressionContext {
-    fn default() -> Self {
-        CompressionContext {
-            #[cfg(feature = "zstd")]
-            compressor: None,
-        }
-    }
-}
-
 impl CompressionContext {
     #[cfg(feature = "zstd")]
     fn zstd_compressor(&mut self) -> &mut zstd::bulk::Compressor<'static> {

Reply via email to