Skip to content

Commit 8d3a3f2

Browse files
committed
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
1 parent 4f9c579 commit 8d3a3f2

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

libs/input/rust/input_verifier.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,22 @@ fn verify_event(
3939
| MotionAction::Up => {
4040
if pointer_count != 1 {
4141
return Err(format!(
42-
"Invalid {} event: there are {} pointers in the event",
43-
action, pointer_count
42+
"Invalid {action} event: there are {pointer_count} pointers in the event",
4443
));
4544
}
4645
}
4746

4847
MotionAction::Cancel => {
4948
if !flags.contains(MotionFlags::CANCELED) {
5049
return Err(format!(
51-
"For ACTION_CANCEL, must set FLAG_CANCELED. Received flags: {:#?}",
52-
flags
50+
"For ACTION_CANCEL, must set FLAG_CANCELED. Received flags: {flags:#?}",
5351
));
5452
}
5553
}
5654

5755
MotionAction::PointerDown { action_index } | MotionAction::PointerUp { action_index } => {
5856
if action_index >= pointer_count {
59-
return Err(format!("Got {}, but event has {} pointer(s)", action, pointer_count));
57+
return Err(format!("Got {action}, but event has {pointer_count} pointer(s)"));
6058
}
6159
}
6260

0 commit comments

Comments
 (0)