diff options
| author | Mehmet Koseoglu <mehmet.mkoseoglu@gmail.com> | 2026-08-28 04:50:20 +0300 |
|---|---|---|
| committer | Miguel Ojeda <ojeda@kernel.org> | 2026-09-01 02:20:22 +0200 |
| commit | e510334fbaeaa016ac76d80b4c5f47611c5f7860 (patch) | |
| tree | 6f442e14bf7dbd04add99fddc91b41af0a9c6e67 | |
| parent | b6b9e6d4abe87b16ab55990b887c6fad8e7a01af (diff) | |
| download | linux-e510334fbaeaa016ac76d80b4c5f47611c5f7860.tar.gz linux-e510334fbaeaa016ac76d80b4c5f47611c5f7860.zip | |
rust: samples: add missing newlines in rust_print_main
Calls to `pr_info!` in `arc_print` are missing trailing newlines, which
are expected as the `pr_*!` documentation shows.
Add the missing `\n` to all four formatting strings.
Fixes: f431c5c581fa ("samples: rust: print: Add sample code for Arc printing")
Fixes: 47cb6bf7860c ("rust: use derive(CoercePointee) on rustc >= 1.84.0")
Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1139
Signed-off-by: Mehmet Koseoglu <mehmet.mkoseoglu@gmail.com>
Link: https://patch.msgid.link/20260828015148.221737-2-mehmet.mkoseoglu@gmail.com
[ Reworded to fix the description of the missing-newline behavior. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
| -rw-r--r-- | samples/rust/rust_print_main.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/samples/rust/rust_print_main.rs b/samples/rust/rust_print_main.rs index 682207c81fc2..01729e87d6b5 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 kernel::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_print() -> Result { } // Pretty-prints the debug formatting with lower-case hexadecimal integers. - pr_info!("{:#x?}", a); + pr_info!("{:#x?}\n", a); Ok(()) } |
