You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Martin Tzvetanov Grigorov (Jira)" <ji...@apache.org> on 2021/07/07 12:28:00 UTC

[jira] [Updated] (AVRO-3175) Rust: fix lint/clippy errors and warnings

     [ https://issues.apache.org/jira/browse/AVRO-3175?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Tzvetanov Grigorov updated AVRO-3175:
--------------------------------------------
    Summary: Rust: fix lint/clippy errors and warnings  (was: Rust: fix lint/clippy errors)

> Rust: fix lint/clippy errors and warnings
> -----------------------------------------
>
>                 Key: AVRO-3175
>                 URL: https://issues.apache.org/jira/browse/AVRO-3175
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: rust
>    Affects Versions: 1.10.2
>            Reporter: Martin Tzvetanov Grigorov
>            Priority: Minor
>
> Running `{color:#0073bf}cargo {color}clippy --all-targets --all-features -- -Dclippy::all` produces errors and warnings like:
>  
> {code:java}
>  error: question mark operator is useless here
>    --> src/ser.rs:378:9
>     |
> 378 |         Ok(ser::SerializeSeq::end(self)?)
>     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ser::SerializeSeq::end(self)`
>     |
>     = note: `-D clippy::needless-question-mark` implied by `-D clippy::all`
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_markerror: called `is_none()` after searching an `Iterator` with `find`
>   --> src/schema_compatibility.rs:99:32
>    |
> 99 |                         return w_symbols.iter().find(|e| !r_symbols.contains(e)).is_none();
>    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `!_.any()` instead: `!w_symbols.iter().any(|e| !r_symbols.contains(e))`
>    |
>    = note: `-D clippy::search-is-some` implied by `-D clippy::all`
>    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_someerror: aborting due to 2 previous errorserror: could not compile `avro-rs`
> error: used `assert_eq!` with a literal bool
>    --> src/ser.rs:795:9
>     |
> 795 |         assert_eq!(to_value(test).is_err(), true);
>     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
>     |
>     = note: `-D clippy::bool-assert-comparison` implied by `-D clippy::all`
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: used `assert_eq!` with a literal bool
>    --> src/schema_compatibility.rs:600:9
>     |
> 600 | /         assert_eq!(
> 601 | |             SchemaCompatibility::can_read(&reader_schema, &writer_schema()),
> 602 | |             false
> 603 | |         );
>     | |__________^ help: replace it with: `assert!(..)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: used `assert_eq!` with a literal bool
>    --> src/schema_compatibility.rs:620:9
>     |
> 620 | /         assert_eq!(
> 621 | |             SchemaCompatibility::can_read(&reader_schema, &writer_schema()),
> 622 | |             false
> 623 | |         );
>     | |__________^ help: replace it with: `assert!(..)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: used `assert_eq!` with a literal bool
>    --> src/schema_compatibility.rs:662:9
>     |
> 662 | /         assert_eq!(
> 663 | |             SchemaCompatibility::can_read(&reader_schema, &writer_schema()),
> 664 | |             false
> 665 | |         );
>     | |__________^ help: replace it with: `assert!(..)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: used `assert_eq!` with a literal bool
>    --> src/schema_compatibility.rs:679:9
>     |
> 679 | /         assert_eq!(
> 680 | |             SchemaCompatibility::can_read(&writer_schema(), &reader_schema),
> 681 | |             false
> 682 | |         );
>     | |__________^ help: replace it with: `assert!(..)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: used `assert_eq!` with a literal bool
>    --> src/schema_compatibility.rs:683:9
>     |
> 683 | /         assert_eq!(
> 684 | |             SchemaCompatibility::can_read(&reader_schema, &writer_schema()),
> 685 | |             false
> 686 | |         );
>     | |__________^ help: replace it with: `assert!(..)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: used `assert_eq!` with a literal bool
>    --> src/schema_compatibility.rs:698:9
>     |
> 698 | /         assert_eq!(
> 699 | |             SchemaCompatibility::can_read(&string_array_schema(), &invalid_reader),
> 700 | |             false
> 701 | |         );
>     | |__________^ help: replace it with: `assert!(..)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: used `assert_eq!` with a literal bool
>    --> src/schema_compatibility.rs:711:9
>     |
> 711 | /         assert_eq!(
> 712 | |             SchemaCompatibility::can_read(&Schema::Int, &Schema::String),
> 713 | |             false
> 714 | |         );
>     | |__________^ help: replace it with: `assert!(..)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: used `assert_eq!` with a literal bool
>    --> src/schema_compatibility.rs:723:9
>     |
> 723 | /         assert_eq!(
> 724 | |             SchemaCompatibility::can_read(&union_writer, &union_reader),
> 725 | |             false
> 726 | |         );
>     | |__________^ help: replace it with: `assert!(..)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: used `assert_eq!` with a literal bool
>    --> src/schema_compatibility.rs:750:9
>     |
> 750 | /         assert_eq!(
> 751 | |             SchemaCompatibility::can_read(&string_schema, &int_schema),
> 752 | |             false
> 753 | |         );
>     | |__________^ help: replace it with: `assert!(..)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: used `assert_eq!` with a literal bool
>    --> src/schema_compatibility.rs:767:9
>     |
> 767 | /         assert_eq!(
> 768 | |             SchemaCompatibility::can_read(&enum_schema2, &enum_schema1),
> 769 | |             false
> 770 | |         );
>     | |__________^ help: replace it with: `assert!(..)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: used `assert_eq!` with a literal bool
>    --> src/schema_compatibility.rs:847:9
>     |
> 847 | /         assert_eq!(
> 848 | |             SchemaCompatibility::can_read(&point_2d_fullname_schema(), &read_schema),
> 849 | |             false
> 850 | |         );
>     | |__________^ help: replace it with: `assert!(..)`
>     |
>     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparisonerror: called `is_none()` after searching an `Iterator` with `find`
>   --> src/schema_compatibility.rs:99:32
>    |
> 99 |                         return w_symbols.iter().find(|e| !r_symbols.contains(e)).is_none();
>    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `!_.any()` instead: `!w_symbols.iter().any(|e| !r_symbols.contains(e))`
>    |
>    = note: `-D clippy::search-is-some` implied by `-D clippy::all`
>    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_someerror: aborting due to previous errorerror: could not compile `avro-rs`To learn more, run the command again with --verbose.
> warning: build failed, waiting for other jobs to finish...
> error: aborting due to 12 previous errorserror: build failed
> {code}



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