Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d3a3f2b authored by Harry Cutts's avatar Harry Cutts
Browse files

InputVerifier: use named parameters to format! where possible

...so long as a call can name all of its parameters, to avoid confusion
around which positional parameters go where.

Bug: 245989146
Test: m
Flag: EXEMPT refactor
Change-Id: Ia40aa0dbc51b990a867451f00cbf3b961fc3210f
parent 4f9c5794
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -39,8 +39,7 @@ fn verify_event(
        | MotionAction::Up => {
            if pointer_count != 1 {
                return Err(format!(
                    "Invalid {} event: there are {} pointers in the event",
                    action, pointer_count
                    "Invalid {action} event: there are {pointer_count} pointers in the event",
                ));
            }
        }
@@ -48,15 +47,14 @@ fn verify_event(
        MotionAction::Cancel => {
            if !flags.contains(MotionFlags::CANCELED) {
                return Err(format!(
                    "For ACTION_CANCEL, must set FLAG_CANCELED. Received flags: {:#?}",
                    flags
                    "For ACTION_CANCEL, must set FLAG_CANCELED. Received flags: {flags:#?}",
                ));
            }
        }

        MotionAction::PointerDown { action_index } | MotionAction::PointerUp { action_index } => {
            if action_index >= pointer_count {
                return Err(format!("Got {}, but event has {} pointer(s)", action, pointer_count));
                return Err(format!("Got {action}, but event has {pointer_count} pointer(s)"));
            }
        }