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 DDC93EED7; Sun, 22 Jun 2025 20:48:00 +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=1750625281; cv=none; b=D880t6gzMENFqNrS/vCrMUy6NRtIa0Oi19mSqvHUGFRcsJenWsb7fd/kX+XR1p5vK1OVE7T9uBTWZqyKF2ejcWgn1gpxJIfbkj0QIaqziXf2S6UoAJYegUascRAH30PBOYvJnygie4sAuZfrcdg+OzvHsJEXdQzWHWMmDWj21Ts= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750625281; c=relaxed/simple; bh=1yzpw0aUJx2y0SjGulr7CeIflyI3UmgsKgd71+6sBYc=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=Ea0FRx4vjDYIjpmC3ptahscbBM1CdqlJ/hXVkuis27fdrUwVBrRLKSDcglZqZkOULyYSkOJz1pNRsJ+FCl6yeuLeKMCoE5j9wM4MA2SaIySjCx07mCX/PkUWWRLfjRGSmWBFzgR1otclzUddWpgTGgiyWAJKYstIlS+Hyuha6D4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oP/qc13G; 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="oP/qc13G" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC089C4CEE3; Sun, 22 Jun 2025 20:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750625280; bh=1yzpw0aUJx2y0SjGulr7CeIflyI3UmgsKgd71+6sBYc=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=oP/qc13GwziYzi4HK3bDWf6l9ZKRotOoHV3Dple7fZ26zmxRLWQLU4HOh8b11JfA1 nRNfMw42DZusrKt45ramcPB9dNRSJR0lsFPwJ0eQ7tUqoOhbFbt8mhNYYT/pPYsZyR B8HxKI+d8XyBYZGTVoLySPENgIbEzY+yLR76fJ52eNlKwfh7ixG+Q2tIiMQzbx+4Ja gRGeJ2tDGI52A8m7rYscsNQFzaqCOh9JTV5HzJ75qkCnVhFs0RcwLuiS3ALxBVwGzx uPE/0CmVDNCz82cOgeUDlL3l9VQ2J8Z+Ytkd5yYEj7BcFoB18PDdWGAjPlnFmRNFeD mX6ZOUsdZVEdA== Precedence: bulk X-Mailing-List: linux-kernel@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: Sun, 22 Jun 2025 22:47:55 +0200 Message-Id: Cc: , , Subject: Re: [PATCH v2 4/4] rust: devres: implement register_release() From: "Benno Lossin" To: "Danilo Krummrich" , , , , , , , , , , , , , , , X-Mailer: aerc 0.20.1 References: <20250622164050.20358-1-dakr@kernel.org> <20250622164050.20358-5-dakr@kernel.org> In-Reply-To: <20250622164050.20358-5-dakr@kernel.org> On Sun Jun 22, 2025 at 6:40 PM CEST, Danilo Krummrich wrote: > +impl Release for crate::sync::ArcBorrow<'_, T> { > + fn release(&self) { > + self.deref().release(); > + } > +} > + > +impl Release for Pin<&'_ T> { You don't need the `'_` here. > + fn release(&self) { > + self.deref().release(); > + } > +} I still think we're missing a `impl Release for &T`. And maybe a closure design is better, depending on how much code is usually run in `release`, if it's a lot, then we should use the trait design. If it's only 1-5 lines, then a closure would also be fine. I don't have a strong preference, but if it's mostly one liners, then closures would be better. If you keep the trait design & we resolve the `&T: Release` question: Reviewed-by: Benno Lossin --- Cheers, Benno