From df74c9f8a70dec64fec38446de3c896dfb378784 Mon Sep 17 00:00:00 2001 From: Martin Tzvetanov Grigorov Date: Tue, 2 Jan 2024 20:14:01 +0200 Subject: [PATCH] NO-ISSUE: [Rust] Fix clippy errors for Rust 1.75.0 Signed-off-by: Martin Tzvetanov Grigorov --- 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 258ea87b0f5..6ebbb21a8ca 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 c3fde21e490..97d6b7174f7 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 89488b7e577..1fab03203f6 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:?}")