Skip to content

Fix multiple derives #3

@schneems

Description

@schneems
 buildpacks-ruby   test    1 error     1 fail   

 1  error[E0252]: the name `_cache_diff` is defined multiple times                                                                                                                                                                                            ▐
   --> commons/src/layer/diff_migrate.rs:211:64                                                                                                                                                                                                               ▐
                                                                                                                                                                                                                                                              ▐
 2  failed: commons/src/layer/diff_migrate.rs - layer::diff_migrate (line 187)                                                                                                                                                                                ▐
    |
 10 | #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq, CacheDiff)]
    |                                                               --------- previous import of the module `_cache_diff` here
 ...
 27 |  #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq, CacheDiff)]
    |                                                                ^^^^^^^^^ `_cache_diff` reimported here
    |
    = note: `_cache_diff` must be defined only once in the type namespace of this block
    = note: this error originates in the derive macro `CacheDiff` (in Nightly builds, run with -Z macro-backtrace for more info)
use magic_migrate::TryMigrate;
use cache_diff::CacheDiff;
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq, CacheDiff)]
#[serde(deny_unknown_fields)]
pub(crate) struct MetadataV1 {
    #[cache_diff(rename = "Ruby version")]
    pub(crate) version: String,
}
 #[derive(Debug)]
pub(crate) enum MigrationError {}
impl std::fmt::Display for MigrationError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        todo!()
    }
}

#[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq, CacheDiff)]
#[serde(deny_unknown_fields)]
pub(crate) struct MetadataV2 {
    #[cache_diff(rename = "Ruby version")]
    pub(crate) version: String,

    #[cache_diff(rename = "OS distribution")]
    pub(crate) distro: String
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions