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 Value::Number(n) => Ok(n as u32), 934 Value::Number(n) => Ok(n as u32),
935 Value::String(s) => { 935 Value::String(s) => {
936 let s = s.to_str()?; 936 let s = s.to_str()?;
937 - if s.starts_with('#') { 937 + if let Some(hex) = s.strip_prefix('#') {
938 - u32::from_str_radix(&s[1..], 16).map_err(|e| { 938 + u32::from_str_radix(hex, 16).map_err(|e| {
939 mlua::Error::RuntimeError(format!( 939 mlua::Error::RuntimeError(format!(
940 "invalid hex color '{}': {}. use format like #ff0000 or 0xff0000", 940 "invalid hex color '{}': {}. use format like #ff0000 or 0xff0000",
941 s, e 941 s, e
942 )) 942 ))
943 }) 943 })
944 - } else if s.starts_with("0x") { 944 + } else if let Some(hex) = s.strip_prefix("0x") {
945 - u32::from_str_radix(&s[2..], 16).map_err(|e| { 945 + u32::from_str_radix(hex, 16).map_err(|e| {
946 mlua::Error::RuntimeError(format!( 946 mlua::Error::RuntimeError(format!(
947 "invalid hex color '{}': {}. use format like 0xff0000 or #ff0000", 947 "invalid hex color '{}': {}. use format like 0xff0000 or #ff0000",
948 s, e 948 s, e