From eb8fd556e4c62fcf1f6afe3cf4890910b06ad2bd Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Sat, 15 May 2021 23:21:48 +0100 Subject: [PATCH] reuse existing function --- src/colour.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/colour.rs b/src/colour.rs index 9b87a13..a045785 100644 --- a/src/colour.rs +++ b/src/colour.rs @@ -9,9 +9,7 @@ pub struct Colour { impl From<&str> for Colour { fn from(str: &str) -> Self { - let rgb = hex::decode(&str[str.len() - 6..]).unwrap(); - - Colour { red: rgb[0], green: rgb[1], blue: rgb[2] } + Self::from(hex::decode(&str[str.len() - 6..]).unwrap()) } }