Martin Tzvetanov Grigorov created AVRO-3418:
-----------------------------------------------

             Summary: [Rust] Fix clippy errors for Rust 1.59.0
                 Key: AVRO-3418
                 URL: https://issues.apache.org/jira/browse/AVRO-3418
             Project: Apache Avro
          Issue Type: Improvement
          Components: rust
    Affects Versions: 1.11.1, 1.12.0
            Reporter: Martin Tzvetanov Grigorov
            Assignee: Martin Tzvetanov Grigorov


[https://github.com/apache/avro/runs/5322768597?check_suite_focus=true]

 
{code:java}
Clippy results: 0 ICE, 8 errors, 0 warnings, 0 notes, 0 help

  

  
    
    Error: Unable to create clippy annotations! Reason: HttpError: Resource not 
accessible by integration

  

  
    
    Warning: It seems that this Action is executed from the forked repository.

  

  
    
    Warning: GitHub Actions are not allowed to create Check annotations, when 
executed for a forked repos. See 
https://github.com/actions-rs/clippy-check/issues/2 for details.

  

  
    
    Posting clippy checks here instead.

  

  
    
    error: unnecessary closure used to substitute value for `Option::None`

  

  
    
       --> src/decode.rs:208:35

  

  
    
        |

  

  
    
  
    
    208 |                       let variant = variants

  

  
    
        |  ___________________________________^

  

  
    
    209 | |                         .get(

  

  
    
    210 | |                             usize::try_from(index)

  

  
    
    211 | |                                 .map_err(|e| 
Error::ConvertI64ToUsize(e, index))?,

  

  
    
    ...   |

  

  
    
    215 | |                             num_variants: variants.len(),

  

  
    
    216 | |                         })?;

  

  
    
        | |__________________________^

  

  
    
        |

  

  
    
        = note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D 
clippy::all`

  

  
    
        = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations

  

  
    
    help: use `ok_or` instead

  

  
    
        |

  

  
    
    208 ~                     let variant = variants

  

  
    
    209 +                         .get(

  

  
    
    210 +                             usize::try_from(index)

  

  
    
    211 +                                 .map_err(|e| 
Error::ConvertI64ToUsize(e, index))?,

  

  
    
    212 +                         ).ok_or(Error::GetUnionVariant {

  

  
    
    213 +                             index,

  

  
    
      ...

  

  
    
    

  

  
    
    

  

  
    
    error: unnecessary closure used to substitute value for `Option::None`

  

  
    
       --> src/decode.rs:208:35

  

  
    
        |

  

  
    
    208 |                       let variant = variants

  

  
    
        |  ___________________________________^

  

  
    
    209 | |                         .get(

  

  
    
    210 | |                             usize::try_from(index)

  

  
    
    211 | |                                 .map_err(|e| 
Error::ConvertI64ToUsize(e, index))?,

  

  
    
    ...   |

  

  
    
    215 | |                             num_variants: variants.len(),

  

  
    
    216 | |                         })?;

  

  
    
        | |__________________________^

  

  
    
        |

  

  
    
        = note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D 
clippy::all`

  

  
    
        = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations

  

  
    
    help: use `ok_or` instead

  

  
    
        |

  

  
    
    208 ~                     let variant = variants

  

  
    
    209 +                         .get(

  

  
    
    210 +                             usize::try_from(index)

  

  
    
    211 +                                 .map_err(|e| 
Error::ConvertI64ToUsize(e, index))?,

  

  
    
    212 +                         ).ok_or(Error::GetUnionVariant {

  

  
    
    213 +                             index,

  

  
    
      ...

  

  
    
    

  

  
    
    

  

  
    
    error: unnecessary use of `to_owned`

  

  
    
  
    
       --> src/reader.rs:504:23

  

  
    
        |

  

  
    
    504 |         let invalid = 
ENCODED.to_owned().into_iter().skip(1).collect::<Vec<u8>>();

  

  
    
        |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: 
`ENCODED.iter().copied()`

  

  
    
        |

  

  
    
        = note: `-D clippy::unnecessary-to-owned` implied by `-D clippy::all`

  

  
    
        = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned

  

  
    
    

  

  
    
    

  

  
    
    error: unnecessary use of `to_owned`

  

  
    
       --> src/reader.rs:511:23

  

  
    
        |

  

  
    
    511 |           let invalid = ENCODED

  

  
    
        |  _______________________^

  

  
    
    512 | |             .to_owned()

  

  
    
    513 | |             .into_iter()

  

  
    
        | |________________________^ help: use: `ENCODED.iter().copied()`

  

  
    
        |

  

  
    
        = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned

  

  
    
    

  

  
    
    

  

  
    
    error: unnecessary use of `to_owned`

  

  
    
       --> src/reader.rs:534:23

  

  
    
        |

  

  
    
    534 |           let invalid = ENCODED

  

  
    
        |  _______________________^

  

  
    
    535 | |             .to_owned()

  

  
    
    536 | |             .into_iter()

  

  
    
        | |________________________^ help: use: `ENCODED.iter().copied()`

  

  
    
        |

  

  
    
        = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned

  

  
    
    

  

  
    
    

  

  
    
    error: unnecessary use of `to_string`

  

  
    
       --> src/writer.rs:840:57

  

  
    
        |

  

  
    
    840 |             .add_user_metadata("stringKey".to_string(), 
"stringValue".to_string())

  

  
    
        |                                                         
^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"stringValue"`

  

  
    
        |

  

  
    
        = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned

  

  
    
    

  

  
    
    

  

  
    
    error: unnecessary use of `to_string`

  

  
    
       --> src/writer.rs:874:65

  

  
    
        |

  

  
    
    874 |         match writer.add_user_metadata("stringKey".to_string(), 
"value2".to_string()) {

  

  
    
        |                                                                 
^^^^^^^^^^^^^^^^^^^^ help: use: `"value2"`

  

  
    
        |

  

  
    
        = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned

  

  
    
    

  

  
    
  
    
    

  

  
    
    error: unnecessary use of `to_vec`

  

  
    
       --> src/rabin.rs:157:73

  

  
    
        |

  

  
    
    157 |             let result = 
LittleEndian::read_i64(&hasher.finalize_reset().to_vec());

  

  
    
        |                                                                       
  ^^^^^^^^^ help: remove this

  

  
    
        |

  

  
    
        = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned  

  
    
    Error: Exiting due to clippy errors
 {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to