Ryan Skraba created AVRO-3196:
---------------------------------

             Summary: [Build] Clippy breaks with minimum and stable versions
                 Key: AVRO-3196
                 URL: https://issues.apache.org/jira/browse/AVRO-3196
             Project: Apache Avro
          Issue Type: New Feature
            Reporter: Ryan Skraba


Our rust lint works correctly with 1.53, but it looks like we're testing with 
1.48.0 (MSRV) and stable, which is currently 1.54.0.  Both of these are 
currently reporting errors.

Using docker, this succeeds:
{code:java}
docker run -it --rm -v $(pwd):/opt/avro  -w /opt/avro/lang/rust \
    -u $(id -u):$(id -g) \
    -v /tmp/avro-cache/cargo:/opt/avro-cache -e CARGO_HOME=/opt/avro-cache \
    rust:1.53-slim bash -c 'rustup component add clippy &&
        cargo clippy --all-targets --all-features -- -Dclippy::all' {code}
Building with rust:1.48-slim, we get this failure:
{code:java}
    Checking avro-rs v0.13.0 (/opt/avro/lang/rust)
error: unknown clippy lint: clippy::nonstandard_macro_braces
  --> src/error.rs:21:10
   |
21 | #[derive(thiserror::Error, Debug)]
   |          ^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::unknown-clippy-lints` implied by `-D clippy::all`
   = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#unknown_clippy_lints
   = note: this error originates in a derive macro (in Nightly builds, run with 
-Z macro-backtrace for more info)error: aborting due to previous errorerror: 
could not compile `avro-rs` {code}
Building with rust:1.54-slim, we get these failures:
{code:java}
info: downloading component 'clippy'
info: installing component 'clippy'
    Checking avro-rs v0.13.0 (/opt/avro/lang/rust)
error: this expression borrows a reference 
(`&std::vec::Vec<(std::string::String, types::Value)>`) that is immediately 
dereferenced by the compiler
   --> src/de.rs:456:83
    |
456 |             Value::Record(ref fields) => 
visitor.visit_enum(EnumDeserializer::new(&fields)),
    |                                                                           
        ^^^^^^^ help: change this to: `fields`
    |
    = note: `-D clippy::needless-borrow` implied by `-D clippy::all`
    = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowerror: 
this expression borrows a reference (`&std::string::String`) that is 
immediately dereferenced by the compiler
   --> src/de.rs:458:92
    |
458 |             Value::Enum(_index, ref field) => 
visitor.visit_enum(EnumUnitDeserializer::new(&field)),
    |                                                                           
                 ^^^^^^ help: change this to: `field`
    |
    = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowerror: 
this expression borrows a reference (`&types::Value`) that is immediately 
dereferenced by the compiler
   --> src/de.rs:486:63
    |
486 |             Some(item) => 
seed.deserialize(&Deserializer::new(&item)).map(Some),
    |                                                               ^^^^^ help: 
change this to: `item`
    |
    = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowerror: 
this pattern creates a reference to a reference
   --> src/de.rs:500:18
    |
500 |             Some(ref key) => seed
    |                  ^^^^^^^
    |
    = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
help: try this
    |
500 |             Some(key) => seed
501 |                 .deserialize(StringDeserializer {
502 |                     input: key.clone(),
    |error: this pattern creates a reference to a reference
   --> src/de.rs:514:18
    |
514 |             Some(ref value) => 
seed.deserialize(&Deserializer::new(value)),
    |                  ^^^^^^^^^ help: try this: `value`
    |
    = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowerror: 
this expression borrows a reference (`&types::Value`) that is immediately 
dereferenced by the compiler
  --> src/encode.rs:31:16
   |
31 |     encode_ref(&value, schema, buffer)
   |                ^^^^^^ help: change this to: `value`
   |
   = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowerror: 
this expression borrows a reference (`&types::Value`) that is immediately 
dereferenced by the compiler
   --> src/encode.rs:156:12
    |
156 |     encode(&value, schema, &mut buffer);
    |            ^^^^^^ help: change this to: `value`
    |
    = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowerror: 
this pattern creates a reference to a reference
   --> src/reader.rs:299:14
    |
299 |         Some(ref schema) => value.resolve(schema),
    |              ^^^^^^^^^^ help: try this: `schema`
    |
    = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowerror: 
this expression borrows a reference (`&types::Value`) that is immediately 
dereferenced by the compiler
   --> src/writer.rs:281:41
    |
281 |         self.append_bytes(encode_to_vec(&value, schema).as_ref())
    |                                         ^^^^^^ help: change this to: 
`value`
    |
    = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowerror: 
this expression borrows a reference (`&serde_json::Map<std::string::String, 
serde_json::Value>`) that is immediately dereferenced by the compiler
   --> src/schema.rs:467:44
    |
467 |                 let fullname = Name::parse(&inner)?.fullname(None);
    |                                            ^^^^^^ help: change this to: 
`inner`
    |
    = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowerror: 
aborting due to 10 previous errorserror: could not compile `avro-rs` {code}
Should we be targeting one specific version of clippy only?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to