Martin Tzvetanov Grigorov created AVRO-3844:
-----------------------------------------------

             Summary: [Rust] Fix clippy errors with Rust 1.72.0
                 Key: AVRO-3844
                 URL: https://issues.apache.org/jira/browse/AVRO-3844
             Project: Apache Avro
          Issue Type: Improvement
          Components: rust
            Reporter: Martin Tzvetanov Grigorov
            Assignee: Martin Tzvetanov Grigorov


The newly releases Rust 1.72.0 produces the following clippy errors:
{code:java}
  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`{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to