Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3844

[Rust] Fix clippy errors with Rust 1.72.0

    XMLWordPrintableJSON

Details

    Description

      The newly releases Rust 1.72.0 produces the following clippy errors:

        Checking apache-avro v0.16.0 (/home/martin/git/apache/avro/lang/rust/avro)
      error: useless use of `vec!`
         --> avro/src/schema_compatibility.rs:296:16
          |
      296 |             && vec![SchemaKind::Long, SchemaKind::Float, SchemaKind::Double]
          |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[SchemaKind::Long, SchemaKind::Float, SchemaKind::Double]`
          |
          = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
          = note: `-D clippy::useless-vec` implied by `-D clippy::all`error: useless use of `vec!`
         --> avro/src/schema_compatibility.rs:304:16
          |
      304 |             && vec![SchemaKind::Float, SchemaKind::Double]
          |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[SchemaKind::Float, SchemaKind::Double]`
          |
          = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vecerror: could not compile `apache-avro` (lib) due to 2 previous errors
      warning: build failed, waiting for other jobs to finish...
      error: useless use of `vec!`
         --> avro/src/reader.rs:891:25
          |
      891 |         let to_read_1 = vec![0xC3, 0x01];
          |                         ^^^^^^^^^^^^^^^^ help: you can use an array directly: `[0xC3, 0x01]`
          |
       
      error: useless use of `vec!`
         --> avro/tests/io.rs:151:30
          |
      151 |     let promotable_schemas = vec![r#""int""#, r#""long""#, r#""float""#, r#""double""#];
          |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[r#""int""#, r#""long""#, r#""float""#, r#""double""#]`
          |
          = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
          = note: `-D clippy::useless-vec` implied by `-D clippy::all`error: could not compile `apache-avro` (test "io") due to previous error
      warning: build failed, waiting for other jobs to finish...
      error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
         --> avro/src/writer.rs:675:25
          |
      675 |         expected.extend([b'f', b'o', b'o'].into_iter());
          |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[b'f', b'o', b'o']`
          |
      note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
         --> /home/martin/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/collect.rs:377:18
          |
      377 |     fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T);
          |                  ^^^^^^^^^^^^^^^^^^^^^^
          = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
          = note: `-D clippy::useless-conversion` implied by `-D clippy::all`

      Attachments

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              mgrigorov Martin Tzvetanov Grigorov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m