hashgraph / hedera-sdk-rust

The Hedera™ Rust SDK
Apache License 2.0
43 stars 14 forks source link

Get rid of warnings #744

Closed Neurone closed 10 months ago

Neurone commented 11 months ago

Problem

Running `cargo check' I get some warnings. As a dev, it's unclear if I should worry about that. In the doubt, I'm worried.

❯ rustup --version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.74.0 (79e9716c9 2023-11-13)`

❯ cargo check
warning: `&` without an explicit lifetime name cannot be used here
  --> src/ledger_id.rs:30:31
   |
30 |     pub(crate) const MAINNET: &Self = Self::new(&[0]);
   |                               ^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
note: the lint level is defined here
  --> src/lib.rs:28:5
   |
28 |     future_incompatible,
   |     ^^^^^^^^^^^^^^^^^^^
   = note: `#[warn(elided_lifetimes_in_associated_constant)]` implied by `#[warn(future_incompatible)]`
help: use the `'static` lifetime
   |
30 |     pub(crate) const MAINNET: &'static Self = Self::new(&[0]);
   |                                +++++++

warning: `&` without an explicit lifetime name cannot be used here
  --> src/ledger_id.rs:31:31
   |
31 |     pub(crate) const TESTNET: &Self = Self::new(&[1]);
   |                               ^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
help: use the `'static` lifetime
   |
31 |     pub(crate) const TESTNET: &'static Self = Self::new(&[1]);
   |                                +++++++

warning: `&` without an explicit lifetime name cannot be used here
  --> src/ledger_id.rs:32:34
   |
32 |     pub(crate) const PREVIEWNET: &Self = Self::new(&[2]);
   |                                  ^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
help: use the `'static` lifetime
   |
32 |     pub(crate) const PREVIEWNET: &'static Self = Self::new(&[2]);
   |                                   +++++++

warning: `hedera` (lib) generated 3 warnings (run `cargo fix --lib -p hedera` to apply 3 suggestions)
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s

Solution

Get rid of warnings, fixing the code or setting the offending lines as "not applicable/ignore warning".

Alternatives

No response