beer-protocols/graphics: simplify parse function

Co-authored-by: faukah <fau@faukah.com>
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ibe83c5e6f06ab1c9900f759ac4940ce86a6a6964
This commit is contained in:
raf 2026-06-27 01:42:41 +03:00
commit db9b53fdad
No known key found for this signature in database
GPG key ID: 29D95B64378DB4BF

View file

@ -193,8 +193,9 @@ pub fn parse(control: &[u8]) -> GraphicsCommand {
let Some(eq) = pair.iter().position(|&b| b == b'=') else { let Some(eq) = pair.iter().position(|&b| b == b'=') else {
continue; continue;
}; };
let (key, value) = (pair.get(..eq).unwrap_or(&[]), &pair[eq + 1..]); let (key, value) = pair.split_at(eq);
let [key] = key else { continue }; let [key] = key else { continue };
let value = &value[1..];
let ch = value.first().copied(); let ch = value.first().copied();
match key { match key {
b'a' => { b'a' => {