You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: utils.rs
    path of file: ./repos/qr-rs/src
    
    the code of the file until where you have to start completion: // qr-rs: Encode URLs or text into QR codes.
// Copyright (C) 2022 Marco Radocchia
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by
    
pub fn hex_to_rgb(hex: &str) -> [u8; 3] {
    let mut hex = hex.strip_prefix('#').unwrap().to_string();
    if hex.len() == 3 {
        let mut expanded = String::new();
        for c in hex.chars() {
            for _ in 0..2 {
                expanded.push(c)
            }
        }
        hex = expanded;
    }

    let mut rgb: [u8; 3] = [0, 0, 0];
    for (i, rgb_val) in rgb.iter_mut().enumerate() {
        let (f, s) = hex[2 * i..2 * (i + 1)].split_at(1);
        let f = u8::from_str_radix(f, 16).unwrap();
        let s = u8::from_str_radix(s, 16).unwrap();
        *rgb_val = f * 16 + s;
    }

    rgb
}