Skip to content

AttrValue's PartialEq takes the enum variant into account #2161

@ranile

Description

@ranile

Problem

AttrValue derives PartialEq. That implementation returns false if same string in two different variants is compared.

See #2159

Steps To Reproduce

let a = AttrValue::Owned("same".to_string());
let b = AttrValue::Static("same");
assert_eq!(a.as_ref(), b.as_ref()); // <- equals
assert_eq!(a, b) // <- does not equal

Code snippet taken from #2159

Expected behavior
a and b in above snippet are equal.

assert_eq!(a, b) // <- equals

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  • Yew version: master
  • Rust version: irrelevant
  • Target, if relevant: irrelevant
  • Build tool, if relevant: irrelevant
  • OS, if relevant: irrelevant
  • Browser and version, if relevant: irrelevant

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-yewArea: The main yew cratebug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions