rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alban Kurti <kurti@invicto.ai>
To: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"David Gow" <davidgow@google.com>,
	"Dirk Behme" <dirk.behme@de.bosch.com>,
	"Asahi Lina" <lina@asahilina.net>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Wedson Almeida Filho" <walmeida@microsoft.com>,
	"Andreas Hindborg (Samsung)" <nmi@metaspace.dk>,
	"Tejun Heo" <tj@kernel.org>, "Fiona Behrens" <me@kloenk.dev>,
	"Vincenzo Palazzo" <vincenzopalazzodev@gmail.com>,
	"Xiangfei Ding" <dingxiangfei2009@gmail.com>
Cc: rust-for-linux@vger.kernel.org, linux-doc@vger.kernel.org,
	 linux-kernel@vger.kernel.org, Alban Kurti <kurti@invicto.ai>,
	 Martin Rodriguez Reboredo <yakoyoku@gmail.com>,
	 Fox Chen <foxhlchen@gmail.com>
Subject: [PATCH v3 6/6] rust: samples: add missing newline to pr_info! calls in rust_print_main
Date: Thu, 06 Feb 2025 21:07:57 +0000 (UTC)	[thread overview]
Message-ID: <20250206-printing_fix-v3-6-a85273b501ae@invicto.ai> (raw)
In-Reply-To: <20250206-printing_fix-v3-0-a85273b501ae@invicto.ai>

The sample code in samples/rust/rust_print_main.rs contained pr_info!
calls without a newline. This commit updates those calls, ensuring
that the output is properly formatted when the sample is run.

Fixes: f431c5c581fa ("samples: rust: print: Add sample code for Arc printing")
Fixes: 47cb6bf7860c ("rust: use derive(CoercePointee) on rustc >= 1.84.0")
Reported-by: Miguel Ojeda <ojeda@kernel.org>
Closes: https://github.com/Rust-for-Linux/linux/issues/1139
Signed-off-by: Alban Kurti <kurti@invicto.ai>
---
 samples/rust/rust_print_main.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/samples/rust/rust_print_main.rs b/samples/rust/rust_print_main.rs
index 7e8af5f176a33925881c7d65b34c823028b7b93b..7ef3cecc65a15627276699c691273608253c9df5 100644
--- a/samples/rust/rust_print_main.rs
+++ b/samples/rust/rust_print_main.rs
@@ -23,10 +23,10 @@ fn arc_print() -> Result {
     let b = UniqueArc::new("hello, world", GFP_KERNEL)?;
 
     // Prints the value of data in `a`.
-    pr_info!("{}", a);
+    pr_info!("{}\n", a);
 
     // Uses ":?" to print debug fmt of `b`.
-    pr_info!("{:?}", b);
+    pr_info!("{:?}\n", b);
 
     let a: Arc<&str> = b.into();
     let c = a.clone();
@@ -42,7 +42,7 @@ fn arc_print() -> Result {
 
         use core::fmt::Display;
         fn arc_dyn_print(arc: &Arc<dyn Display>) {
-            pr_info!("Arc<dyn Display> says {arc}");
+            pr_info!("Arc<dyn Display> says {arc}\n");
         }
 
         let a_i32_display: Arc<dyn Display> = Arc::new(42i32, GFP_KERNEL)?;
@@ -53,7 +53,7 @@ fn arc_dyn_print(arc: &Arc<dyn Display>) {
     }
 
     // Pretty-prints the debug formatting with lower-case hexadecimal integers.
-    pr_info!("{:#x?}", a);
+    pr_info!("{:#x?}\n", a);
 
     Ok(())
 }

-- 
2.48.1


  parent reply	other threads:[~2025-02-06 21:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-06 21:07 [PATCH v3 0/6] rust: treewide: add missing newlines to printing calls Alban Kurti
2025-02-06 21:07 ` [PATCH v3 1/6] rust: docs: add missing newline to printing macro examples Alban Kurti
2025-02-07  7:37   ` David Gow
2025-02-06 21:07 ` [PATCH v3 2/6] rust: error: add missing newline to pr_warn! calls Alban Kurti
2025-02-06 21:07 ` [PATCH v3 3/6] rust: init: add missing newline to pr_info! calls Alban Kurti
2025-02-06 21:07 ` [PATCH v3 4/6] rust: sync: add missing newline in locked_by log example Alban Kurti
2025-02-06 21:07 ` [PATCH v3 5/6] rust: workqueue: add missing newline to pr_info! examples Alban Kurti
2025-02-07  9:36   ` Alice Ryhl
2025-02-06 21:07 ` Alban Kurti [this message]
2025-03-05 23:55   ` [PATCH v3 6/6] rust: samples: add missing newline to pr_info! calls in rust_print_main Miguel Ojeda
2025-04-13 20:52     ` Miguel Ojeda
2025-03-06 19:46 ` [PATCH v3 0/6] rust: treewide: add missing newlines to printing calls Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250206-printing_fix-v3-6-a85273b501ae@invicto.ai \
    --to=kurti@invicto.ai \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=corbet@lwn.net \
    --cc=davidgow@google.com \
    --cc=dingxiangfei2009@gmail.com \
    --cc=dirk.behme@de.bosch.com \
    --cc=foxhlchen@gmail.com \
    --cc=gary@garyguo.net \
    --cc=lina@asahilina.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@kloenk.dev \
    --cc=nmi@metaspace.dk \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=vincenzopalazzodev@gmail.com \
    --cc=walmeida@microsoft.com \
    --cc=wedsonaf@gmail.com \
    --cc=yakoyoku@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).