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

Rust: fix lint/clippy errors and warnings

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.10.2
    • 1.11.0
    • rust
    • None
    • Reviewed

    Description

      Running `cargo clippy --all-targets --all-features – -Dclippy::all` produces errors and warnings like:

       

       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
      

      Attachments

        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: