Inconsistent clone() requirement when passing Classes to HTML elements vs. components (#3589) (#3931)

* Add From<&Classes> impl to allow &Classes in element props (#3589)
* bless macro test error output

adds an additional candidate to the impl block, which is fine

---------

Co-authored-by: Martin Molzer <WorldSEnder@users.noreply.github.com>
This commit is contained in:
Siddhant Shekhar 2025-10-22 19:23:51 +05:30 committed by GitHub
parent 0c986740ac
commit 38e7f2bcf4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 6 deletions

View File

@ -17,6 +17,7 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
| ^^ the trait `From<{integer}>` is not implemented for `Classes`
|
= help: the following other types implement trait `From<T>`:
`Classes` implements `From<&Classes>`
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -24,7 +25,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
`Classes` implements `From<&str>`
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
and $N others
= note: required for `{integer}` to implement `Into<Classes>`
note: required by a bound in `Classes::push`
@ -40,6 +40,7 @@ error[E0277]: the trait bound `Classes: From<{float}>` is not satisfied
| ^^^^ the trait `From<{float}>` is not implemented for `Classes`
|
= help: the following other types implement trait `From<T>`:
`Classes` implements `From<&Classes>`
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -47,7 +48,6 @@ error[E0277]: the trait bound `Classes: From<{float}>` is not satisfied
`Classes` implements `From<&str>`
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
and $N others
= note: required for `{float}` to implement `Into<Classes>`
note: required by a bound in `Classes::push`
@ -66,6 +66,7 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
| required by a bound introduced by this call
|
= help: the following other types implement trait `From<T>`:
`Classes` implements `From<&Classes>`
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -73,7 +74,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
`Classes` implements `From<&str>`
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
and $N others
= note: required for `{integer}` to implement `Into<Classes>`
= note: required for `Classes` to implement `From<Vec<{integer}>>`
@ -92,6 +92,7 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
| ^^^^ the trait `From<{integer}>` is not implemented for `Classes`
|
= help: the following other types implement trait `From<T>`:
`Classes` implements `From<&Classes>`
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -99,7 +100,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
`Classes` implements `From<&str>`
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
and $N others
= note: required for `{integer}` to implement `Into<Classes>`
= note: required for `Classes` to implement `From<Option<{integer}>>`
@ -118,6 +118,7 @@ error[E0277]: the trait bound `Classes: From<u32>` is not satisfied
| ^^^^ the trait `From<u32>` is not implemented for `Classes`
|
= help: the following other types implement trait `From<T>`:
`Classes` implements `From<&Classes>`
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -125,7 +126,6 @@ error[E0277]: the trait bound `Classes: From<u32>` is not satisfied
`Classes` implements `From<&str>`
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
and $N others
= note: required for `u32` to implement `Into<Classes>`
= note: required for `Classes` to implement `From<Option<u32>>`
@ -144,6 +144,7 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
| ^^ the trait `From<{integer}>` is not implemented for `Classes`
|
= help: the following other types implement trait `From<T>`:
`Classes` implements `From<&Classes>`
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -151,7 +152,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
`Classes` implements `From<&str>`
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
and $N others
= note: required for `{integer}` to implement `Into<Classes>`
note: required by a bound in `Classes::push`

View File

@ -695,6 +695,7 @@ error[E0277]: the trait bound `implicit_clone::unsync::string::IString: From<{in
| ^^ the trait `From<{integer}>` is not implemented for `implicit_clone::unsync::string::IString`
|
= help: the following other types implement trait `From<T>`:
`implicit_clone::unsync::string::IString` implements `From<&Classes>`
`implicit_clone::unsync::string::IString` implements `From<&implicit_clone::unsync::string::IString>`
`implicit_clone::unsync::string::IString` implements `From<&str>`
`implicit_clone::unsync::string::IString` implements `From<Arguments<'_>>`

View File

@ -277,6 +277,18 @@ impl<T: Into<Classes>, const SIZE: usize> From<[T; SIZE]> for Classes {
}
}
impl From<&Classes> for Classes {
fn from(c: &Classes) -> Self {
c.clone()
}
}
impl From<&Classes> for AttrValue {
fn from(c: &Classes) -> Self {
c.clone().into_prop_value()
}
}
impl PartialEq for Classes {
fn eq(&self, other: &Self) -> bool {
self.set.len() == other.set.len() && self.set.iter().eq(other.set.iter())