tony / oxwm

config/lua_api: apply clippy lint (manual_strip) Browse files
emzywastaken committed 2025-12-15 parent e69df37 commit 585a932c34403df26b92cc8bac54a7e5899d72f7
Showing 1 changed file with 4 additions and 4 deletions. UnifiedSplit
+4 −4 src/config/lua_api.rs
@@ -934,15 +934,15 @@ fn parse_color_value(value: Value) -> mlua::Result<u32> {
934 934 Value::Number(n) => Ok(n as u32),
935 935 Value::String(s) => {
936 936 let s = s.to_str()?;
937 - if s.starts_with('#') {
938 - u32::from_str_radix(&s[1..], 16).map_err(|e| {
937 + if let Some(hex) = s.strip_prefix('#') {
938 + u32::from_str_radix(hex, 16).map_err(|e| {
939 939 mlua::Error::RuntimeError(format!(
940 940 "invalid hex color '{}': {}. use format like #ff0000 or 0xff0000",
941 941 s, e
942 942 ))
943 943 })
944 - } else if s.starts_with("0x") {
945 - u32::from_str_radix(&s[2..], 16).map_err(|e| {
944 + } else if let Some(hex) = s.strip_prefix("0x") {
945 + u32::from_str_radix(hex, 16).map_err(|e| {
946 946 mlua::Error::RuntimeError(format!(
947 947 "invalid hex color '{}': {}. use format like 0xff0000 or #ff0000",
948 948 s, e