From 63d716de902b18e57ba6bc93a39c18cb92134213 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Fri, 21 Feb 2025 15:32:31 -0500 Subject: [PATCH] Preserve line numbers by not injecting a newline (#2653) The `dbg!` macro, being deployed more widely in #2478, shows the line number. But if we inject `#![allow(..)]\n` then the printed numbers do not match those in the textarea. It turns out that `\n` is not required! cc @egithinji --- theme/book.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/book.js b/theme/book.js index fb4f7a93..66e86989 100644 --- a/theme/book.js +++ b/theme/book.js @@ -130,7 +130,7 @@ function playground_text(playground, hidden = true) { // Unless the code block has `warnunused`, allow all "unused" lints to avoid cluttering // the output. if(!classes.contains("warnunused")) { - text = '#![allow(unused)]\n' + text; + text = '#![allow(unused)] ' + text; } let edition = "2015"; if(classes.contains("edition2018")) {