All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charalampos Mitrodimas <charmitro@posteo.net>
To: albankurti <kurti@invicto.ai>
Cc: rust-for-linux@vger.kernel.org,  ojeda@kernel.org
Subject: Re: [PATCH] rust: printing macros sample: add missing newlines
Date: Mon, 03 Feb 2025 21:38:52 +0000	[thread overview]
Message-ID: <m2y0ym3dzn.fsf@posteo.net> (raw)
In-Reply-To: <20250203133717.264522-1-kurti@invicto.ai> (albankurti's message of "Mon, 03 Feb 2025 13:37:18 +0000 (UTC)")

albankurti <kurti@invicto.ai> writes:

> Fixes calls to pr_*! to include \n
>
> Reported-by: ojeda <ojeda@kernel.org>
> Closes: https://github.com/Rust-for-Linux/linux/issues/1139
> Signed-off-by: albankurti <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 7e8af5f176a3..7ef3cecc65a1 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(())
>  }

Hi Alban,

We also have these, but not sure if we care about them, since they are
comments.

  rust/kernel/print.rs
  408:/// pr_info!("hello");

  rust/kernel/init.rs
  885:    ///         pr_info!("Setting up foo");
  989:    ///         pr_info!("Setting up foo");
  1339:///         pr_info!("Foo is being dropped!");

  rust/kernel/init/macros.rs
  48://!         pr_info!("{self:p} is getting dropped.");
  415://!         pr_info!("{self:p} is getting dropped.");
  426://!         pr_info!("{self:p} is getting dropped.");

Otherwise,
Reviewed-by: Charalampos Mitrodimas <charmitro.posteo.net>


  reply	other threads:[~2025-02-03 21:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 13:37 [PATCH] rust: printing macros sample: add missing newlines albankurti
2025-02-03 21:38 ` Charalampos Mitrodimas [this message]
2025-02-05 12:52   ` Miguel Ojeda
2025-02-05 12:52 ` 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=m2y0ym3dzn.fsf@posteo.net \
    --to=charmitro@posteo.net \
    --cc=kurti@invicto.ai \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.