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 2024/01/02 18:14:55 UTC

(avro) branch branch-1.11 updated: NO-ISSUE: [Rust] Fix clippy errors for Rust 1.75.0

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 c5f824041 NO-ISSUE: [Rust] Fix clippy errors for Rust 1.75.0
c5f824041 is described below

commit c5f824041a51134f256e8c47be76b2d38d1c0018
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Tue Jan 2 20:14:01 2024 +0200

    NO-ISSUE: [Rust] Fix clippy errors for Rust 1.75.0
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
    (cherry picked from commit df74c9f8a70dec64fec38446de3c896dfb378784)
---
 lang/rust/avro/src/schema.rs          | 4 ++--
 lang/rust/avro/src/types.rs           | 2 +-
 lang/rust/avro_derive/tests/derive.rs | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lang/rust/avro/src/schema.rs b/lang/rust/avro/src/schema.rs
index 3f84daab7..3ab7a1356 100644
--- a/lang/rust/avro/src/schema.rs
+++ b/lang/rust/avro/src/schema.rs
@@ -737,7 +737,7 @@ impl RecordField {
                     });
 
                     if !resolved {
-                        let schema: Option<&Schema> = schemas.get(0);
+                        let schema: Option<&Schema> = schemas.first();
                         return match schema {
                             Some(first_schema) => Err(Error::GetDefaultUnion(
                                 SchemaKind::from(first_schema),
@@ -2541,7 +2541,7 @@ mod tests {
 
         match schema_a {
             Schema::Record(RecordSchema { fields, .. }) => {
-                let f1 = fields.get(0);
+                let f1 = fields.first();
 
                 let ref_schema = Schema::Ref {
                     name: Name::new("B")?,
diff --git a/lang/rust/avro/src/types.rs b/lang/rust/avro/src/types.rs
index c2b286b6b..e2272ec9f 100644
--- a/lang/rust/avro/src/types.rs
+++ b/lang/rust/avro/src/types.rs
@@ -2927,7 +2927,7 @@ Field with name '"b"' is not a member of the map items"#,
 
         let schemas = Schema::parse_list(&[main_schema, referenced_schema])?;
 
-        let main_schema = schemas.get(0).unwrap();
+        let main_schema = schemas.first().unwrap();
         let schemata: Vec<_> = schemas.iter().skip(1).collect();
 
         let resolve_result = avro_value.clone().resolve_schemata(main_schema, schemata);
diff --git a/lang/rust/avro_derive/tests/derive.rs b/lang/rust/avro_derive/tests/derive.rs
index 89488b7e5..1fab03203 100644
--- a/lang/rust/avro_derive/tests/derive.rs
+++ b/lang/rust/avro_derive/tests/derive.rs
@@ -1565,7 +1565,7 @@ mod test_derive {
 
         let derived_schema = TestRawIdent::get_schema();
         if let Schema::Record(RecordSchema { fields, .. }) = derived_schema {
-            let field = fields.get(0).expect("TestRawIdent must contain a field");
+            let field = fields.first().expect("TestRawIdent must contain a field");
             assert_eq!(field.name, "type");
         } else {
             panic!("Unexpected schema type for {derived_schema:?}")