rust-lang / git2-rs

libgit2 bindings for Rust
https://docs.rs/git2
Apache License 2.0
1.69k stars 387 forks source link

"cargo test" fails due to several warnings that are treated as errors #950

Closed rcook closed 1 year ago

rcook commented 1 year ago

Building on Linux host:

$ git rev-parse HEAD
c42e8e964b99e193ec3e64619c2be34f262ea0c2
$ cargo clean
$ cargo test
...
...
...
warning: panic message is not a string literal
  --> src/panic.rs:27:16
   |
27 |         panic!(err)
   |                ^^^
   |
   = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
   = note: `#[warn(non_fmt_panics)]` on by default
help: add a "{:?}" format string to use the `Debug` implementation of `Box<dyn Any + Send>`
   |
27 |         panic!("{:?}", err)
   |                +++++++
help: or use std::panic::panic_any instead
   |
27 |         std::panic::panic_any(err)
   |         ~~~~~~~~~~~~~~~~~~~~~

warning: unused return value of `Box::<T>::from_raw` that must be used
   --> src/odb.rs:456:13
    |
456 |             Box::from_raw(self.progress_payload_ptr);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: call `drop(Box::from_raw(ptr))` if you intend to drop the `Box`
    = note: `#[warn(unused_must_use)]` on by default

error: panic message is not a string literal
  --> src/panic.rs:27:16
   |
27 |         panic!(err)
   |                ^^^
   |
   = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
note: the lint level is defined here
  --> src/lib.rs:72:24
   |
72 | #![cfg_attr(test, deny(warnings))]
   |                        ^^^^^^^^
   = note: `#[deny(non_fmt_panics)]` implied by `#[deny(warnings)]`
help: add a "{:?}" format string to use the `Debug` implementation of `Box<dyn Any + Send>`
   |
27 |         panic!("{:?}", err)
   |                +++++++
help: or use std::panic::panic_any instead
   |
27 |         std::panic::panic_any(err)
   |         ~~~~~~~~~~~~~~~~~~~~~

error: unused return value of `Box::<T>::from_raw` that must be used
   --> src/odb.rs:456:13
    |
456 |             Box::from_raw(self.progress_payload_ptr);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: call `drop(Box::from_raw(ptr))` if you intend to drop the `Box`
    = note: `#[deny(unused_must_use)]` implied by `#[deny(warnings)]`

error: could not compile `git2` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
warning: `git2` (lib) generated 2 warnings
rcook commented 1 year ago

It looks like these issue have already been fixed.