You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/08/15 06:25:28 UTC

[avro] branch branch-1.11 updated: AVRO-3608: Rust: Fix clippy errors in Rust 1.63.0 (#1825)

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

mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/branch-1.11 by this push:
     new 98dd55411 AVRO-3608: Rust: Fix clippy errors in Rust 1.63.0 (#1825)
98dd55411 is described below

commit 98dd55411fd4ceeb21354dff425e6d3efd50a78e
Author: Martin Grigorov <ma...@users.noreply.github.com>
AuthorDate: Mon Aug 15 09:24:47 2022 +0300

    AVRO-3608: Rust: Fix clippy errors in Rust 1.63.0 (#1825)
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
    (cherry picked from commit bce7ad409a26e16255839363d7596f8a3bca3d70)
---
 lang/rust/avro/src/codec.rs    | 2 +-
 lang/rust/avro/src/duration.rs | 8 ++++----
 lang/rust/avro/src/encode.rs   | 2 +-
 lang/rust/avro/src/schema.rs   | 2 +-
 lang/rust/avro/src/types.rs    | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lang/rust/avro/src/codec.rs b/lang/rust/avro/src/codec.rs
index 4d63e4cd5..0866ff62d 100644
--- a/lang/rust/avro/src/codec.rs
+++ b/lang/rust/avro/src/codec.rs
@@ -34,7 +34,7 @@ use crc32fast::Hasher;
 use xz2::read::{XzDecoder, XzEncoder};
 
 /// The compression codec used to compress blocks.
-#[derive(Clone, Copy, Debug, PartialEq, EnumIter, EnumString, IntoStaticStr)]
+#[derive(Clone, Copy, Debug, Eq, PartialEq, EnumIter, EnumString, IntoStaticStr)]
 #[strum(serialize_all = "kebab_case")]
 pub enum Codec {
     /// The `Null` codec simply passes through data uncompressed.
diff --git a/lang/rust/avro/src/duration.rs b/lang/rust/avro/src/duration.rs
index 378c891cb..3bdfe4d23 100644
--- a/lang/rust/avro/src/duration.rs
+++ b/lang/rust/avro/src/duration.rs
@@ -20,14 +20,14 @@ use zerocopy::U32;
 
 /// A struct representing duration that hides the details of endianness and conversion between
 /// platform-native u32 and byte arrays.
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
 pub struct Duration {
     months: Months,
     days: Days,
     millis: Millis,
 }
 
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
 pub struct Months(U32<LittleEndian>);
 
 impl Months {
@@ -54,7 +54,7 @@ impl AsRef<[u8; 4]> for Months {
     }
 }
 
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
 pub struct Days(U32<LittleEndian>);
 
 impl Days {
@@ -81,7 +81,7 @@ impl AsRef<[u8; 4]> for Days {
     }
 }
 
-#[derive(Debug, Copy, Clone, PartialEq)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
 pub struct Millis(U32<LittleEndian>);
 
 impl Millis {
diff --git a/lang/rust/avro/src/encode.rs b/lang/rust/avro/src/encode.rs
index 0d40a498f..143c52542 100644
--- a/lang/rust/avro/src/encode.rs
+++ b/lang/rust/avro/src/encode.rs
@@ -150,7 +150,7 @@ pub(crate) fn encode_internal<S: Borrow<Schema>>(
                     .get(*idx as usize)
                     .expect("Invalid Union validation occurred");
                 encode_long(*idx as i64, buffer);
-                encode_internal(&*item, inner_schema, names, enclosing_namespace, buffer)?;
+                encode_internal(item, inner_schema, names, enclosing_namespace, buffer)?;
             } else {
                 error!("invalid schema type for Union: {:?}", schema);
                 return Err(Error::EncodeValueAsSchemaError {
diff --git a/lang/rust/avro/src/schema.rs b/lang/rust/avro/src/schema.rs
index e96b16d66..0a9603fe7 100644
--- a/lang/rust/avro/src/schema.rs
+++ b/lang/rust/avro/src/schema.rs
@@ -578,7 +578,7 @@ pub struct RecordField {
 }
 
 /// Represents any valid order for a `field` in a `record` Avro schema.
-#[derive(Clone, Debug, PartialEq, EnumString)]
+#[derive(Clone, Debug, Eq, PartialEq, EnumString)]
 #[strum(serialize_all = "kebab_case")]
 pub enum RecordFieldOrder {
     Ascending,
diff --git a/lang/rust/avro/src/types.rs b/lang/rust/avro/src/types.rs
index 045694509..042350b93 100644
--- a/lang/rust/avro/src/types.rs
+++ b/lang/rust/avro/src/types.rs
@@ -369,11 +369,11 @@ impl Value {
         match (self, schema) {
             (_, &Schema::Ref { ref name }) => names.get(name).map_or_else(
                 || {
-                    return Some(format!(
+                    Some(format!(
                         "Unresolved schema reference: '{}'. Parsed names: {:?}",
                         name,
                         names.keys()
-                    ));
+                    ))
                 },
                 |s| self.validate_internal(s.borrow(), names),
             ),