On Wed, 7 Jan 2026 10:54:42 +0100 Miguel Ojeda <[email protected]> wrote:
> On Wed, Jan 7, 2026 at 3:10 AM John Hubbard <[email protected]> wrote: > > > > So there is not yet a clear convention visible in the code. > > > > Miguel, Alice, Gary et al, is there actually a preference already? > > They are supposed to have the `\n`. > > For a bit of context: when we discussed the printing a long time ago, > I originally had: > > info!("foo"); > > instead of: > > pr_info!("foo\n"); > > i.e. both the prefix and the newline were assumed, but we were asked > to keep it close to the C side, which is fair. In very early days (before RfL is upstreamed), I had a prototype print macro that is designed like this: info!("foo"); // pr_info("foo\n"); info!(target: dev, "foo"); // dev_info(dev, "foo\n"); info!(target: dev, once, "foo"); // dev_info_once(dev, "foo\n"); info!(target: dev, ratelimited, "foo"); // dev_info_ratelimited(dev, "foo\n"); There's a trait that is implemented for anything that can be used as a printing target. I still think this is superior than just having our macro mimicking the C side (and as a result, having a lot of macros rather than just one for each level). I think with Rust printing machinary, `pr_cont` is rarely useful, instead of calling `pr_info` followed by multiple `pr_cont`, you can just have a custom `Display` implementation and print it in one go. This is also free from racing against another print and have your lines broken into two parts. I would be much in favour of vouching deleteing `pr_cont` entirely from Rust codebase and always have newlines automatically added. Best, Gary
