Merge 0bed579a4bbca0b788cef986da3cd5117f8cf94f into 7850a73d95c02840f4ab3bf8d9571b08410e5467

This commit is contained in:
Eugen 2025-12-26 01:16:04 +00:00 committed by GitHub
commit 0d192ddbe4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,13 +52,12 @@ impl TryFrom<&[i16]> for Color {
type Error = IntoColorError;
fn try_from(slice: &[i16]) -> Result<Self, Self::Error> {
// Check the length.
if slice.len() != 3 {
return Err(IntoColorError::BadLen);
if let &[red, green, blue] = slice {
// Reuse the implementation for a tuple.
Self::try_from((red, green, blue))
} else {
Err(IntoColorError::BadLen)
}
// Reuse the implementation for a tuple.
Self::try_from((slice[0], slice[1], slice[2]))
}
}