You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-08-10 01:07:09 +02:00
Allow the 'unused' category of lints (#2571)
These sort of warnings can be distracting when commenting out a few lines of code or demonstrating some other concept. They can be re-enabled for a code block with `warnunused`. I filed https://github.com/rust-lang/mdBook/issues/2527 to get behavior like this upstream.
This commit is contained in:
committed by
GitHub
parent
9fa1b645be
commit
5f7e0c3f64
@ -127,6 +127,11 @@ function playground_text(playground, hidden = true) {
|
||||
|
||||
let text = playground_text(code_block);
|
||||
let classes = code_block.querySelector('code').classList;
|
||||
// Unless the code block has `warnunused`, allow all "unused" lints to avoid cluttering
|
||||
// the output.
|
||||
if(!classes.contains("warnunused")) {
|
||||
text = '#![allow(unused)]\n' + text;
|
||||
}
|
||||
let edition = "2015";
|
||||
if(classes.contains("edition2018")) {
|
||||
edition = "2018";
|
||||
|
Reference in New Issue
Block a user