binder: use irrefutable let patterns

Replace matches on infallible results with irrefutable let patterns,
which are available since Rust 1.82.

This removes boilerplate for handling impossible error variants.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Acked-by: Carlos Llamas <cmllamas@google.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260921-binder_let-v1-1-0cfc4c535544@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Alexandre Courbot 2026-09-21 00:49:28 +09:00 committed by Greg Kroah-Hartman
parent 2390a07e8e
commit d835f4b1ad
3 changed files with 8 additions and 21 deletions

View File

@ -75,10 +75,8 @@ fn new(flags: kernel::alloc::Flags) -> Result<UninitFM, AllocError> {
}
fn init(ua: UninitFM, cookie: FreezeCookie, pid: i32) -> DLArc<FreezeMessage> {
match ua.pin_init_with(DTRWrap::new(FreezeMessage { cookie, pid })) {
Ok(msg) => ListArc::from(msg),
Err(err) => match err {},
}
let Ok(msg) = ua.pin_init_with(DTRWrap::new(FreezeMessage { cookie, pid }));
ListArc::from(msg)
}
}

View File

@ -20,10 +20,8 @@ pub(crate) fn new() -> Result<Self> {
}
pub(super) fn init(self, node: DArc<Node>) -> DLArc<dyn DeliverToRead> {
match self.inner.pin_init_with(DTRWrap::new(NodeWrapper { node })) {
Ok(initialized) => ListArc::from(initialized) as DLArc<dyn DeliverToRead>,
Err(err) => match err {},
}
let Ok(initialized) = self.inner.pin_init_with(DTRWrap::new(NodeWrapper { node }));
ListArc::from(initialized) as DLArc<dyn DeliverToRead>
}
}

View File

@ -900,11 +900,8 @@ pub(crate) fn insert_or_update_handle(
let (info_proc, info_node) = {
let info_init = NodeRefInfo::new(node_ref, handle, self.into());
match info.pin_init_with(info_init) {
Ok(info) => ListArc::pair_from_pin_unique(info),
// error is infallible
Err(err) => match err {},
}
let Ok(info) = info.pin_init_with(info_init);
ListArc::pair_from_pin_unique(info)
};
// Ensure the process is still alive while we insert a new reference.
@ -1301,14 +1298,8 @@ pub(crate) fn request_death(
return Ok(());
}
let death = {
let death_init = NodeDeath::new(info.node_ref().node.clone(), self.clone(), cookie);
match death.pin_init_with(death_init) {
Ok(death) => death,
// error is infallible
Err(err) => match err {},
}
};
let death_init = NodeDeath::new(info.node_ref().node.clone(), self.clone(), cookie);
let Ok(death) = death.pin_init_with(death_init);
// Register the death notification.
{