This is an automated email from the ASF dual-hosted git repository. mgrigorov pushed a commit to branch avro-3836-fix-build-with-rust-1.65.0 in repository https://gitbox.apache.org/repos/asf/avro.git
commit 9c0ebe6515a0d76889de2fbd845917d663535864 Author: Martin Tzvetanov Grigorov <[email protected]> AuthorDate: Fri Aug 18 16:15:47 2023 +0300 AVRO-3836: [Rust] Fix the build with Rust 1.65.0 Fix clippy issues with Rust 1.65.0 Run clippy also for MSRV Signed-off-by: Martin Tzvetanov Grigorov <[email protected]> --- .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 d688473bd..81c978f73 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 58e95e8cc..223305876 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,
