diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index 7916d8f9471f88..d0a145dad06421 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -1503,7 +1503,7 @@ pub fn get_color_at_index(index: usize, theme: &Theme) -> Hsla { 15 => colors.terminal_ansi_bright_white, // 16-231 are mapped to their RGB colors on a 0-5 range per channel 16..=231 => { - let (r, g, b) = rgb_for_index(&(index as u8)); // Split the index into its ANSI-RGB components + let (r, g, b) = rgb_for_index(index as u8); // Split the index into its ANSI-RGB components let step = (u8::MAX as f32 / 5.).floor() as u8; // Split the RGB range into 5 chunks, with floor so no overflow rgba_color(r * step, g * step, b * step) // Map the ANSI-RGB components to an RGB color } @@ -1542,8 +1542,8 @@ pub fn get_color_at_index(index: usize, theme: &Theme) -> Hsla { /// ``` /// /// This function does the reverse, calculating the `r`, `g`, and `b` components from a given index. -fn rgb_for_index(i: &u8) -> (u8, u8, u8) { - debug_assert!((&16..=&231).contains(&i)); +fn rgb_for_index(i: u8) -> (u8, u8, u8) { + debug_assert!((16..=231).contains(&i)); let i = i - 16; let r = (i - (i % 36)) / 36; let g = ((i % 36) - (i % 6)) / 6; @@ -1578,7 +1578,7 @@ mod tests { fn test_rgb_for_index() { // Test every possible value in the color cube. for i in 16..=231 { - let (r, g, b) = rgb_for_index(&i); + let (r, g, b) = rgb_for_index(i); assert_eq!(i, 16 + 36 * r + 6 * g + b); } }