archlinux / alpm.rs

Rust bindings for libalpm
GNU General Public License v3.0
112 stars 21 forks source link

Update dependencies (new semver) and fix some compile warnings #37

Open VorpalBlade opened 6 months ago

VorpalBlade commented 6 months ago

This helps avoid duplicate dependencies in my program (two versions of bitflags).

I also fixed cargo build warnings. I did not look into the existing cargo clippy warnings.

I'm not sure if this is semver compatible or requires a new major release. I tried to use cargo-semver-checks to check this automatically but it doesn't work on alpm (see https://github.com/obi1kenobi/cargo-semver-checks/issues/654). If it isn't semver compatible it is likely that some extra derives may be needed for the bitflags.

VorpalBlade commented 6 months ago

After figuring out how to use cargo-semver-checks I fixed a number of semver issues. However it seems that there is one unavoidable issue:

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.28.0/src/lints/inherent_method_missing.ron

Failed in:
  Capabilities::from_bits_unchecked, previously in file /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alpm-2.2.3/src/alpm.rs:112
  SigLevel::from_bits_unchecked, previously in file /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alpm-2.2.3/src/types.rs:43
  TransFlag::from_bits_unchecked, previously in file /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alpm-2.2.3/src/trans.rs:10
  PackageValidation::from_bits_unchecked, previously in file /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alpm-2.2.3/src/types.rs:109
  LogLevel::from_bits_unchecked, previously in file /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alpm-2.2.3/src/types.rs:69
  Usage::from_bits_unchecked, previously in file /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alpm-2.2.3/src/types.rs:58

This is because the API of bitflags changed. We could define custom a impl that forwards to bitflags I suppose. It is your call what you want to do however.