ipld / libipld

Rust IPLD library
Apache License 2.0
135 stars 40 forks source link

Fix warnings on rustc 1.72 #191

Closed aDotInTheVoid closed 1 year ago

aDotInTheVoid commented 1 year ago

Due to #![deny(warnings)] these are needed to develop on the project with the latest release.

error: using `.deref()` on a double reference, which returns `&T` instead of dereferencing the inner type
  --> core/src/codec.rs:50:13
   |
50 |         self.deref().encode(c, w)
   |             ^^^^^^^^
   |
note: the lint level is defined here
  --> core/src/lib.rs:3:9
   |
3  | #![deny(warnings)]
   |         ^^^^^^^^
   = note: `#[deny(suspicious_double_ref_op)]` implied by `#[deny(warnings)]`
Error:   --> dag-cbor/src/cbor.rs:74:17
   |
74 |                 20 | 21 | 22 => (),
   |                 ^^^^^^^^^^^^ help: try: `20..=22`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_patterns
note: the lint level is defined here
  --> dag-cbor/src/lib.rs:3:9
   |
3  | #![deny(warnings)]
   |         ^^^^^^^^
   = note: `#[deny(clippy::manual_range_patterns)]` implied by `#[deny(warnings)]`
error: incorrect implementation of `clone` on a `Copy` type
  --> core/src/link.rs:44:29
   |
44 |       fn clone(&self) -> Self {
   |  _____________________________^
45 | |         Self {
46 | |             cid: self.cid,
47 | |             _marker: self._marker,
48 | |         }
49 | |     }
   | |_____^ help: change this to: `{ *self }`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_clone_impl_on_copy_type
   = note: `#[deny(clippy::incorrect_clone_impl_on_copy_type)]` on by default
error: use of `default` to create a unit struct
  --> dag-cbor-derive/examples/basic.rs:55:47
   |
55 |     assert_roundtrip(DagCborCodec, &UnitStruct::default(), &ipld!(null));
   |                                               ^^^^^^^^^^^ help: remove this call to `default`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
   = note: `-D clippy::default-constructed-unit-structs` implied by `-D warnings`
error: used `unwrap()` on `Some` value
   --> core/tests/serde_deserializer.rs:534:35
    |
534 |     let ipld_some = Ipld::Integer(option_some.unwrap().into());
    |                                   ^^^^^^^^^^^^^^^^^^^^
    |
help: remove the `Some` and `unwrap()`
   --> core/tests/serde_deserializer.rs:532:35
    |
532 |     let option_some: Option<u8> = Some(58u8);
    |                                   ^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_unwrap
    = note: `-D clippy::unnecessary-literal-unwrap` implied by `-D warnings`