simplify
This commit is contained in:
@@ -17,11 +17,10 @@ impl From<&str> for Colour {
|
||||
|
||||
impl From<Vec<u8>> for Colour {
|
||||
fn from(colours: Vec<u8>) -> Self {
|
||||
const ZERO: u8 = 0;
|
||||
Colour {
|
||||
red: *colours.get(0).unwrap_or(&ZERO),
|
||||
green: *colours.get(1).unwrap_or(&ZERO),
|
||||
blue: *colours.get(2).unwrap_or(&ZERO),
|
||||
red: *colours.get(0).unwrap_or(&0),
|
||||
green: *colours.get(1).unwrap_or(&0),
|
||||
blue: *colours.get(2).unwrap_or(&0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user