capnproto-rust icon indicating copy to clipboard operation
capnproto-rust copied to clipboard

Clippy on the nightly version complains about explicit lifetimes that could be elided in the autogenerated code

Open ariel-miculas opened this issue 1 year ago • 0 comments

Examples from a PuzzleFS action:

error: the following explicit lifetimes could be elided: 'a
  --> /home/amiculas/work/cisco/puzzlefs/target/debug/build/puzzlefs-lib-d2835cfcf1bcc89b/out/metadata_capnp.rs:15:9
   |
15 |   impl <'a,> ::core::marker::Copy for Reader<'a,>  {}
   |         ^^                                   ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `-D clippy::needless-lifetimes` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_lifetimes)]`
help: elide the lifetimes
   |
15 -   impl <'a,> ::core::marker::Copy for Reader<'a,>  {}
15 +   impl  ::core::marker::Copy for Reader<'_,>  {}
   |

error: the following explicit lifetimes could be elided: 'a
  --> /home/amiculas/work/cisco/puzzlefs/target/debug/build/puzzlefs-lib-d2835cfcf1bcc89b/out/metadata_capnp.rs:16:9
   |
16 |   impl <'a,> ::core::clone::Clone for Reader<'a,>  {
   |         ^^                                   ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
16 -   impl <'a,> ::core::clone::Clone for Reader<'a,>  {
16 +   impl  ::core::clone::Clone for Reader<'_,>  {
   |

error: the following explicit lifetimes could be elided: 'a
  --> /home/amiculas/work/cisco/puzzlefs/target/debug/build/puzzlefs-lib-d2835cfcf1bcc89b/out/metadata_capnp.rs:20:9
   |
20 |   impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,>  {
   |         ^^                                         ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
20 -   impl <'a,> ::capnp::traits::HasTypeId for Reader<'a,>  {
20 +   impl  ::capnp::traits::HasTypeId for Reader<'_,>  {
   |

ariel-miculas avatar Oct 04 '24 19:10 ariel-miculas