[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <62F430CC-9980-4779-9D43-7D561D322C9B@kloenk.de>
Date: Fri, 03 Nov 2023 11:51:07 +0100
From: Finn Behrens <finn@...enk.de>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arve Hjønnevåg <arve@...roid.com>,
Todd Kjos <tkjos@...roid.com>,
Martijn Coenen <maco@...roid.com>,
Joel Fernandes <joel@...lfernandes.org>,
Christian Brauner <brauner@...nel.org>,
Carlos Llamas <cmllamas@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...sung.com>,
Matt Gilbride <mattgilbride@...gle.com>,
Jeffrey Vander Stoep <jeffv@...gle.com>,
Matthew Maurer <mmaurer@...gle.com>
Subject: Re: [PATCH RFC 03/20] rust_binder: add threading support
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”)?
Powered by blists - more mailing lists