Skip to content

Commit

Permalink
Preserve line numbers by not injecting a newline (#2653)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
djmitche authored Feb 21, 2025
1 parent 63cc474 commit 63d716d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion theme/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down

0 comments on commit 63d716d

Please sign in to comment.