Messages in this thread | | | From | Finn Behrens <> | Subject | Re: [PATCH RFC 03/20] rust_binder: add threading support | Date | Fri, 03 Nov 2023 11:51:07 +0100 |
| |
On 1 Nov 2023, at 19:01, Alice Ryhl wrote:
> diff --git a/drivers/android/error.rs b/drivers/android/error.rs > new file mode 100644 > index 000000000000..41fc4347ab55 > --- /dev/null > +++ b/drivers/android/error.rs > + > +impl core::fmt::Debug for BinderError { > + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { > + match self.reply { > + BR_FAILED_REPLY => match self.source.as_ref() { > + Some(source) => f > + .debug_struct("BR_FAILED_REPLY") > + .field("source", source) > + .finish(), > + None => f.pad("BR_FAILED_REPLY"), > + }, > + BR_DEAD_REPLY => f.pad("BR_DEAD_REPLY"), > + BR_TRANSACTION_COMPLETE => f.pad("BR_TRANSACTION_COMPLETE"), > + _ => f > + .debug_struct("BinderError") > + .field("reply", &self.reply) > + .finish(), > + } > + } > +} Renaming the debug_struct itself feels like it will make it harder to find later, as I would expect that a debug implementation names the struct its from. Also this has the fallback in CamelCase and all defined cases as SCREAMING_SNAKE_CASE. Maybe rather in the defined cases something like f.debug_struct(‘BinderError’).field(‘reply’, “name”)?
| |