@@ -56,6 +56,8 @@ Regarding the loop templates: what I *want* is for the result of the closure to
5656
5757/// The template used for `--loop` input, assuming no `--count` flag is also given.
5858pub const LOOP_TEMPLATE : & str = r#"
59+ #![allow(unused_imports)]
60+ #![allow(unused_braces)]
5961#{prelude}
6062use std::any::Any;
6163use std::io::prelude::*;
@@ -65,15 +67,15 @@ fn main() {
6567{#{script}}
6668 );
6769 let mut line_buffer = String::new();
68- let mut stdin = std::io::stdin();
70+ let stdin = std::io::stdin();
6971 loop {
7072 line_buffer.clear();
7173 let read_res = stdin.read_line(&mut line_buffer).unwrap_or(0);
7274 if read_res == 0 { break }
7375 let output = closure(&line_buffer);
7476
7577 let display = {
76- let output_any: &Any = &output;
78+ let output_any: &dyn Any = &output;
7779 !output_any.is::<()>()
7880 };
7981
@@ -91,6 +93,8 @@ where F: FnMut(&str) -> T, T: 'static {
9193
9294/// The template used for `--count --loop` input.
9395pub const LOOP_COUNT_TEMPLATE : & str = r#"
96+ #![allow(unused_imports)]
97+ #![allow(unused_braces)]
9498use std::any::Any;
9599use std::io::prelude::*;
96100
@@ -99,7 +103,7 @@ fn main() {
99103{#{script}}
100104 );
101105 let mut line_buffer = String::new();
102- let mut stdin = std::io::stdin();
106+ let stdin = std::io::stdin();
103107 let mut count = 0;
104108 loop {
105109 line_buffer.clear();
@@ -109,7 +113,7 @@ fn main() {
109113 let output = closure(&line_buffer, count);
110114
111115 let display = {
112- let output_any: &Any = &output;
116+ let output_any: &dyn Any = &output;
113117 !output_any.is::<()>()
114118 };
115119
0 commit comments