Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 3 tasks
Tracked by #2052
hamza1311 opened this issue Nov 19, 2021 · 2 comments · Fixed by #2162
Closed
1 of 3 tasks
Tracked by #2052

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

hamza1311 opened this issue Nov 19, 2021 · 2 comments · Fixed by #2162
Labels
A-yew Area: The main yew crate bug

Comments

@hamza1311
Copy link
Member

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
@hamza1311 hamza1311 added the bug label Nov 19, 2021
@hamza1311
Copy link
Member Author

@mibes, if you would like to work on it, feel free to. If you don't want to/can't, no problem, I will PR the fix. Please let me know if you take on it so we don't duplicate work.

@hamza1311 hamza1311 added the A-yew Area: The main yew crate label Nov 19, 2021
@hamza1311 hamza1311 changed the title AttrValue's PartialEq takes the enum varient into account AttrValue's PartialEq takes the enum variant into account Nov 19, 2021
@mibes
Copy link
Contributor

mibes commented Nov 19, 2021

@hamza1311 I'm happy to dig into this and do a PR.

voidpumpkin pushed a commit that referenced this issue Nov 20, 2021
* Attempt to fix recursion on display

* Include into_string() for AttrValue

* PartialEq takes the enum variant into account #2161

Co-authored-by: mibes <mibes@avaya.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-yew Area: The main yew crate bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants