From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCA112877C7; Fri, 4 Jul 2025 10:05:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751623541; cv=none; b=SKmhhTy2nycJPZ7nFszWAZiFJarf70YCmeXcN+pOwvxH0vMKuoioFTDbQRpC5ncpfCRj0/NZ+ibd4qG5YbqrNp5A4GiBAgK1b67lOmx4IDpcils/5qwgN7+/hkeevOFroRt2y9WGXz5+na1gEz6BOAlcucpBD604As8EWtrVJD4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751623541; c=relaxed/simple; bh=3zMvBpnjYhXNk119LId6VxXRlohR+SMqHtEt+DjGgOs=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=Lw1FLW99xPWNr/qjic2EsDUo68wNQjAZq6pA+jWDO/bLp/oGaGiEwKpHmervEXwOmSI4KesNrU3KuCjHnH3rtFVwl+YwLRdS4sIEo/9ktlLjPuMm+uSD+pB0OPoQWRgaLgqLJuqRppZOdsWCZY+PyNzDLrwW1+rP5VarwAIpKwo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dIFzhyDo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dIFzhyDo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C8AFC4CEE3; Fri, 4 Jul 2025 10:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751623540; bh=3zMvBpnjYhXNk119LId6VxXRlohR+SMqHtEt+DjGgOs=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=dIFzhyDoOtTAbxDe4ng7ZMrO/97heBHHA2tlOt/nH+8zNG51bHrYZPY5Otop9wkEE GOrKb3MaWAOEqB12OvaklthhMEb5eZrWI0BPDhSMueKmloWwIpmrdhA574pgwdyDVL 5lRojgAt+uopNziY+Nbq2Vyar7Ow/l0OqQ3ieJWWl/vzootQhnKntCRzNGjWwagrXs ZQVT86x9TMFgy9J6Lt1mMum6Y6ipYwyQeTLs74SvWohAan1nxvN+IidtlqAZw2lilc nqy6gMPSSrHzKKMC7HAuqqW0Qh3uEfCRekMqt+80F1Dobu3rSHA5697iSIX1wfMM87 5aWiEaLuho2cA== Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 04 Jul 2025 12:05:26 +0200 Message-Id: Cc: "Michal Rostecki" , "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "Brendan Higgins" , "David Gow" , "Rae Moar" , "Danilo Krummrich" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , "Simona Vetter" , "Greg Kroah-Hartman" , "Rafael J. Wysocki" , "Luis Chamberlain" , "Russ Weight" , "FUJITA Tomonori" , "Rob Herring" , "Saravana Kannan" , "Peter Zijlstra" , "Ingo Molnar" , "Will Deacon" , "Waiman Long" , "Nathan Chancellor" , "Nick Desaulniers" , "Bill Wendling" , "Justin Stitt" , "Andrew Lunn" , "Heiner Kallweit" , "Russell King" , "David S. Miller" , "Eric Dumazet" , "Jakub Kicinski" , "Paolo Abeni" , "Bjorn Helgaas" , "Arnd Bergmann" , "Jens Axboe" , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , "Dave Ertman" , "Ira Weiny" , "Leon Romanovsky" , "Breno Leitao" , "Viresh Kumar" , "Michael Turquette" , "Stephen Boyd" , , , , , , , , , , , , , Subject: Re: [PATCH v13 2/5] rust: support formatting of foreign types From: "Benno Lossin" To: "Tamir Duberstein" X-Mailer: aerc 0.20.1 References: <20250701-cstr-core-v13-0-29f7d3eb97a6@gmail.com> <20250701-cstr-core-v13-2-29f7d3eb97a6@gmail.com> In-Reply-To: On Fri Jul 4, 2025 at 12:41 AM CEST, Tamir Duberstein wrote: > On Thu, Jul 3, 2025 at 4:36=E2=80=AFPM Benno Lossin w= rote: >> On Thu Jul 3, 2025 at 8:55 PM CEST, Tamir Duberstein wrote: >> > On Thu, Jul 3, 2025 at 11:08=E2=80=AFAM Benno Lossin wrote: >> >> On Thu Jul 3, 2025 at 3:55 PM CEST, Tamir Duberstein wrote: >> >> > On Thu, Jul 3, 2025 at 5:32=E2=80=AFAM Benno Lossin wrote: >> >> >> On Tue Jul 1, 2025 at 6:49 PM CEST, Tamir Duberstein wrote: >> >> >> > +impl fmt::Display for Adapter<&T> { >> >> >> > + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { >> >> >> > + let Self(t) =3D self; >> >> >> > + Display::fmt(t, f) >> >> >> >> >> >> Why not `Display::fmt(&self.0, f)`? >> >> > >> >> > I like destructuring because it shows me that there's only one fiel= d. >> >> > With `self.0` I don't see that. >> >> >> >> And what is the benefit here? >> > >> > In general the benefit is that the method does not ignore some portion >> > of `Self`. A method that uses `self.0` would not provoke a compiler >> > error in case another field is added, while this form would. >> >> Yeah, but why would that change happen here? And even if it got another >> field, why would that invalidate the impl of `fn fmt`? > > I don't know, but I would rather force a person to make that decision > when they add another field rather than assume that such an addition > wouldn't require changes here. I don't think so. If this were in another file, then destructuring might make sense if the struct could conceivably get more fields in the future **and** it if the other file relied on there only being one field (or if it *had* to be changed when there was a field added). This isn't the case here so it's just unnecessary noise. --- Cheers, Benno