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
diff --git a/libs/input/rust/input_verifier.rs b/libs/input/rust/input_verifier.rs
index b1d7760..bddd2a7 100644
--- a/libs/input/rust/input_verifier.rs
+++ b/libs/input/rust/input_verifier.rs
@@ -39,8 +39,7 @@
| 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 @@
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)"));
}
}