Merge pull request #1195 from englishm/me/suppress-more-warnings-for-small-listings

Broaden scope of suppressed warnings for listings without a main fn
This commit is contained in:
Eric Huss 2020-04-18 08:33:30 -07:00 committed by GitHub
commit 04c04dfc88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -633,7 +633,7 @@ fn add_playpen_pre(html: &str, playpen_config: &Playpen) -> String {
let (attrs, code) = partition_source(code);
format!(
"\n# #![allow(unused_variables)]\n{}#fn main() {{\n{}#}}",
"\n# #![allow(unused)]\n{}#fn main() {{\n{}#}}",
attrs, code
)
.into()
@ -756,7 +756,7 @@ mod tests {
fn add_playpen() {
let inputs = [
("<code class=\"language-rust\">x()</code>",
"<pre class=\"playpen\"><code class=\"language-rust\">\n<span class=\"boring\">#![allow(unused_variables)]\n</span><span class=\"boring\">fn main() {\n</span>x()\n<span class=\"boring\">}\n</span></code></pre>"),
"<pre class=\"playpen\"><code class=\"language-rust\">\n<span class=\"boring\">#![allow(unused)]\n</span><span class=\"boring\">fn main() {\n</span>x()\n<span class=\"boring\">}\n</span></code></pre>"),
("<code class=\"language-rust\">fn main() {}</code>",
"<pre class=\"playpen\"><code class=\"language-rust\">fn main() {}\n</code></pre>"),
("<code class=\"language-rust editable\">let s = \"foo\n # bar\n\";</code>",