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 1DB2A286426; Sat, 18 Oct 2025 19:17:06 +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=1760815026; cv=none; b=j/zZR/DyOTsUN6PRRIIzDsYe82M62bQZn83TZHkhA8NlB5lNboMyCjNkVXlPGbqxW03YiGYl6IxDUM1vsKJPHYojYhY2Dd1+0s7nmvmYRB37u7W2FYohSR/bOd7EIWz4rFY60kUHRBGubey0W0UQeQxaoxnMjCe4BDlxQA4fjqY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760815026; c=relaxed/simple; bh=+J7ZDXd3uQ/1GkoKOuS9uOo+Km8UCQlhgVmpqkVteu8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FYJndrbVvH7YukfiQfIGgI4/UOvVj8y/cl/aLulTwai2kz3fZoYEpbL3PFxgAf43bitZPeJI8PgdS3yhFiD2SD+OnzjoDsW1yo3LZV/Vm8AFOJyg8PSISFauDjA2GHmq21AYkHchdprZYICUG1nw2xDcQLa/aQNtAeDR1tNCdYs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Rdb4ZBFB; 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="Rdb4ZBFB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09E1FC4CEF8; Sat, 18 Oct 2025 19:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760815026; bh=+J7ZDXd3uQ/1GkoKOuS9uOo+Km8UCQlhgVmpqkVteu8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Rdb4ZBFBOqUXjkBE8zOpeiiZXAN2GbWcU77iJLXrkor1jDoVY0DpJ3KRvs1y99bxX m4l/bK3blzMAqX+TTf61d7a/EZ+dWnOinqnoPgUN4kjbat85OnpfoBXoV/xiddY43C f8HXWVntKBwDoSVtpJW1p3P8yVsgYTb/7ZysIXJLfHQGudMrzOZa032uNT48FuE1XQ w/Orq/L4fi6KWLKUtls1fNYPag/xlr9aQa2bWRXPU6LAYZYAyethsIZTGKcvpBVPJe NjzMZ8UyLV946cRTpwxHgzMzhyhGkJMabHfr+T9fEDtU8d/3k1ohQDNNGipTcFpVVB 7aIt1/VGve0hw== From: Tamir Duberstein Date: Sat, 18 Oct 2025 15:16:27 -0400 Subject: [RESEND PATCH v18 06/16] rust: alloc: use `kernel::fmt` Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20251018-cstr-core-v18-6-9378a54385f8@gmail.com> References: <20251018-cstr-core-v18-0-9378a54385f8@gmail.com> In-Reply-To: <20251018-cstr-core-v18-0-9378a54385f8@gmail.com> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , =?utf-8?q?Arve_Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Carlos Llamas , Suren Baghdasaryan , Jens Axboe , Lorenzo Stoakes , Vlastimil Babka , "Liam R. Howlett" , Uladzislau Rezki , Bjorn Helgaas , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Viresh Kumar , Nishanth Menon , Stephen Boyd , Breno Leitao , Liam Girdwood , Mark Brown , Michael Turquette , David Airlie , Simona Vetter , Luis Chamberlain , Russ Weight , Alexander Viro , Jan Kara , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fsdevel@vger.kernel.org, llvm@lists.linux.dev, Tamir Duberstein X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openssh-sha256; t=1760814988; l=2039; i=tamird@gmail.com; h=from:subject:message-id; bh=VZx3xyzuE8sdJWwvMWeYLSbsWBC7U7VUNVHO5x1zs/Y=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgtYz36g7iDMSkY5K7Ab51ksGX7hJgs MRt+XVZTrIzMVIAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QJHdEeRE7pQl/p0QRGuCzQ7Ms+9Tlb7y4U2r1vQjNSe9inKMkJqdvw5D0RsFqU1WEd1pada5oWK 2xrUccsoLWAs= X-Developer-Key: i=tamird@gmail.com; a=openssh; fpr=SHA256:264rPmnnrb+ERkS7DDS3tuwqcJss/zevJRzoylqMsbc From: Tamir Duberstein Reduce coupling to implementation details of the formatting machinery by avoiding direct use for `core`'s formatting traits and macros. This backslid in commit 9def0d0a2a1c ("rust: alloc: add Vec::push_within_capacity"). Reviewed-by: Alice Ryhl Acked-by: Danilo Krummrich Signed-off-by: Tamir Duberstein --- rust/kernel/alloc/kvec/errors.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rust/kernel/alloc/kvec/errors.rs b/rust/kernel/alloc/kvec/errors.rs index 21a920a4b09b..e7de5049ee47 100644 --- a/rust/kernel/alloc/kvec/errors.rs +++ b/rust/kernel/alloc/kvec/errors.rs @@ -2,14 +2,14 @@ //! Errors for the [`Vec`] type. -use kernel::fmt::{self, Debug, Formatter}; +use kernel::fmt; use kernel::prelude::*; /// Error type for [`Vec::push_within_capacity`]. pub struct PushError(pub T); -impl Debug for PushError { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { +impl fmt::Debug for PushError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Not enough capacity") } } @@ -25,8 +25,8 @@ fn from(_: PushError) -> Error { /// Error type for [`Vec::remove`]. pub struct RemoveError; -impl Debug for RemoveError { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { +impl fmt::Debug for RemoveError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Index out of bounds") } } @@ -45,8 +45,8 @@ pub enum InsertError { OutOfCapacity(T), } -impl Debug for InsertError { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { +impl fmt::Debug for InsertError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { InsertError::IndexOutOfBounds(_) => write!(f, "Index out of bounds"), InsertError::OutOfCapacity(_) => write!(f, "Not enough capacity"), -- 2.51.1