Fix clippy warnings and add new workflow clippy (#306)

* Derive `Eq` for `PkgFmt`, `PkgFmtDecomposed` & `TarBasedFmt`
* Derive `Eq` for `PkgMeta`, `PkgOverride` & `BinMeta`
* Rm unnecessary reborrow in `install_from_source`
* Rm unnecessary `into()` in `args::parse`
* Fix `clippy` warning in `CratesToml::append_to_path`
* Fix clippy warning in `cratesio_url`
* Fix clippy warning in `detect_targets_linux`
* Add `clippy` and `rustfmt` to workflow `unit-test`

Because `clippy` would not check inactive code disabled by `cfg`, so we
have to also run `clippy` on multiple targets.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-08-21 00:40:50 +10:00 committed by GitHub
parent 4812456357
commit 1102284684
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 14 deletions

View file

@ -30,7 +30,7 @@ pub struct Meta {
/// Metadata for binary installation use.
///
/// Exposed via `[package.metadata]` in `Cargo.toml`
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case", default)]
pub struct PkgMeta {
/// URL template for package downloads
@ -79,7 +79,7 @@ impl PkgMeta {
/// Target specific overrides for binary installation
///
/// Exposed via `[package.metadata.TARGET]` in `Cargo.toml`
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case", default)]
pub struct PkgOverride {
/// URL template override for package downloads
@ -92,7 +92,7 @@ pub struct PkgOverride {
pub bin_dir: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct BinMeta {
/// Binary name