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/24 18:13:14 UTC

[avro] 01/01: AVRO-3844: [Rust] Fix clippy errors with Rust 1.72.0

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch avro-3844-fix-1.72.0-clippy-errors
in repository https://gitbox.apache.org/repos/asf/avro.git

commit 623d09e072060eb8e9623775f5c04dcb7d5af0cc
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Thu Aug 24 21:12:42 2023 +0300

    AVRO-3844: [Rust] Fix clippy errors with Rust 1.72.0
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
---
 lang/rust/avro/src/reader.rs               | 2 +-
 lang/rust/avro/src/schema_compatibility.rs | 4 ++--
 lang/rust/avro/src/writer.rs               | 2 +-
 lang/rust/avro/tests/io.rs                 | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lang/rust/avro/src/reader.rs b/lang/rust/avro/src/reader.rs
index ae0b32de9..2ec0b84cb 100644
--- a/lang/rust/avro/src/reader.rs
+++ b/lang/rust/avro/src/reader.rs
@@ -888,7 +888,7 @@ mod tests {
             c: vec!["cat".into(), "dog".into()],
         };
         // The two-byte marker, to show that the message uses this single-record format
-        let to_read_1 = vec![0xC3, 0x01];
+        let to_read_1 = [0xC3, 0x01];
         let mut to_read_2 = Vec::<u8>::new();
         to_read_2.extend_from_slice(
             &TestSingleObjectReader::get_schema()
diff --git a/lang/rust/avro/src/schema_compatibility.rs b/lang/rust/avro/src/schema_compatibility.rs
index b661054d6..a15c18407 100644
--- a/lang/rust/avro/src/schema_compatibility.rs
+++ b/lang/rust/avro/src/schema_compatibility.rs
@@ -293,7 +293,7 @@ impl SchemaCompatibility {
         }
 
         if w_type == SchemaKind::Int
-            && vec![SchemaKind::Long, SchemaKind::Float, SchemaKind::Double]
+            && [SchemaKind::Long, SchemaKind::Float, SchemaKind::Double]
                 .iter()
                 .any(|&t| t == r_type)
         {
@@ -301,7 +301,7 @@ impl SchemaCompatibility {
         }
 
         if w_type == SchemaKind::Long
-            && vec![SchemaKind::Float, SchemaKind::Double]
+            && [SchemaKind::Float, SchemaKind::Double]
                 .iter()
                 .any(|&t| t == r_type)
         {
diff --git a/lang/rust/avro/src/writer.rs b/lang/rust/avro/src/writer.rs
index 83e863455..83b7d8b00 100644
--- a/lang/rust/avro/src/writer.rs
+++ b/lang/rust/avro/src/writer.rs
@@ -672,7 +672,7 @@ mod tests {
         let mut expected = Vec::new();
         zig_i64(27, &mut expected);
         zig_i64(3, &mut expected);
-        expected.extend(vec![b'f', b'o', b'o'].into_iter());
+        expected.extend([b'f', b'o', b'o']);
 
         assert_eq!(to_avro_datum(&schema, record)?, expected);
 
diff --git a/lang/rust/avro/tests/io.rs b/lang/rust/avro/tests/io.rs
index b835fe7af..ab3712893 100644
--- a/lang/rust/avro/tests/io.rs
+++ b/lang/rust/avro/tests/io.rs
@@ -148,7 +148,7 @@ fn test_binary_long_encoding() -> TestResult {
 fn test_schema_promotion() -> TestResult {
     // Each schema is present in order of promotion (int -> long, long -> float, float -> double)
     // Each value represents the expected decoded value when promoting a value previously encoded with a promotable schema
-    let promotable_schemas = vec![r#""int""#, r#""long""#, r#""float""#, r#""double""#];
+    let promotable_schemas = [r#""int""#, r#""long""#, r#""float""#, r#""double""#];
     let promotable_values = vec![
         Value::Int(219),
         Value::Long(219),