Skip to content

Commit

Permalink
AVRO-3836: [Rust] Fix the build with Rust 1.65.0 (#2454)
Browse files Browse the repository at this point in the history
Fix clippy issues with Rust 1.65.0

Run clippy also for MSRV

Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
  • Loading branch information
martin-g authored Aug 18, 2023
1 parent ab6efb5 commit e22339b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test-lang-rust-clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions lang/rust/avro/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
})
}
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion lang/rust/avro/tests/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e22339b

Please sign in to comment.