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 2023/08/18 19:52:24 UTC

[avro] branch branch-1.11 updated: AVRO-3836: [Rust] Fix the build with Rust 1.65.0 (#2454)

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 fddb5640d AVRO-3836: [Rust] Fix the build with Rust 1.65.0 (#2454)
fddb5640d is described below

commit fddb5640d70e57c65a01b5d33e775b99919374cf
Author: Martin Grigorov <ma...@users.noreply.github.com>
AuthorDate: Fri Aug 18 22:52:01 2023 +0300

    AVRO-3836: [Rust] Fix the build with Rust 1.65.0 (#2454)
    
    Fix clippy issues with Rust 1.65.0
    
    Run clippy also for MSRV
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
    (cherry picked from commit e22339b71551fe85e3cd218fc31cc990714a15b9)
---
 .github/workflows/test-lang-rust-clippy.yml |  5 +++++
 lang/rust/avro/src/schema.rs                | 11 +++++++----
 lang/rust/avro/tests/schema.rs              |  2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/test-lang-rust-clippy.yml b/.github/workflows/test-lang-rust-clippy.yml
index a6eb57ea4..1da8b60d1 100644
--- a/.github/workflows/test-lang-rust-clippy.yml
+++ b/.github/workflows/test-lang-rust-clippy.yml
@@ -43,6 +43,11 @@ concurrency:
 jobs:
   clippy_check:
     runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        rust:
+          - 'stable'
+          - '1.65.0'  # MSRV
     steps:
       - uses: actions/checkout@v3
       - uses: dtolnay/rust-toolchain@nightly
diff --git a/lang/rust/avro/src/schema.rs b/lang/rust/avro/src/schema.rs
index 7c6bff723..b3a50c362 100644
--- a/lang/rust/avro/src/schema.rs
+++ b/lang/rust/avro/src/schema.rs
@@ -261,7 +261,11 @@ impl Name {
         Ok(Self {
             name: type_name.unwrap_or(name),
             namespace: namespace_from_name
-                .or_else(|| complex.string("namespace").or(enclosing_namespace.clone()))
+                .or_else(|| {
+                    complex
+                        .string("namespace")
+                        .or_else(|| enclosing_namespace.clone())
+                })
                 .filter(|ns| !ns.is_empty()),
         })
     }
@@ -1420,11 +1424,10 @@ impl Parser {
             }
         }
 
-        let name = Name::parse(complex, enclosing_namespace)?;
-        let aliases = fix_aliases_namespace(complex.aliases(), &name.namespace);
+        let fully_qualified_name = Name::parse(complex, enclosing_namespace)?;
+        let aliases = fix_aliases_namespace(complex.aliases(), &fully_qualified_name.namespace);
 
         let mut lookup = BTreeMap::new();
-        let fully_qualified_name = name.clone();
 
         self.register_resolving_schema(&fully_qualified_name, &aliases);
 
diff --git a/lang/rust/avro/tests/schema.rs b/lang/rust/avro/tests/schema.rs
index 667618411..1508035ab 100644
--- a/lang/rust/avro/tests/schema.rs
+++ b/lang/rust/avro/tests/schema.rs
@@ -1453,7 +1453,7 @@ fn avro_old_issue_47() -> TestResult {
 
     use serde::{Deserialize, Serialize};
 
-    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
+    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
     pub struct MyRecord {
         b: String,
         a: i64,