@@ -8,6 +8,7 @@ use std::path::PathBuf;
8
8
use std:: process:: { self , Command } ;
9
9
10
10
const RUSTC_COLOR_ARGS : & [ & str ] = & [ "--color" , "always" ] ;
11
+ const RUSTC_EDITION_ARGS : & [ & str ] = & [ "--edition" , "2021" ] ;
11
12
const I_AM_DONE_REGEX : & str = r"(?m)^\s*///?\s*I\s+AM\s+NOT\s+DONE" ;
12
13
const CONTEXT : usize = 2 ;
13
14
const CLIPPY_CARGO_TOML_PATH : & str = "./exercises/clippy/Cargo.toml" ;
@@ -111,10 +112,12 @@ impl Exercise {
111
112
Mode :: Compile => Command :: new ( "rustc" )
112
113
. args ( & [ self . path . to_str ( ) . unwrap ( ) , "-o" , & temp_file ( ) ] )
113
114
. args ( RUSTC_COLOR_ARGS )
115
+ . args ( RUSTC_EDITION_ARGS )
114
116
. output ( ) ,
115
117
Mode :: Test => Command :: new ( "rustc" )
116
118
. args ( & [ "--test" , self . path . to_str ( ) . unwrap ( ) , "-o" , & temp_file ( ) ] )
117
119
. args ( RUSTC_COLOR_ARGS )
120
+ . args ( RUSTC_EDITION_ARGS )
118
121
. output ( ) ,
119
122
Mode :: Clippy => {
120
123
let cargo_toml = format ! (
@@ -140,6 +143,7 @@ path = "{}.rs""#,
140
143
Command :: new ( "rustc" )
141
144
. args ( & [ self . path . to_str ( ) . unwrap ( ) , "-o" , & temp_file ( ) ] )
142
145
. args ( RUSTC_COLOR_ARGS )
146
+ . args ( RUSTC_EDITION_ARGS )
143
147
. output ( )
144
148
. expect ( "Failed to compile!" ) ;
145
149
// Due to an issue with Clippy, a cargo clean is required to catch all lints.
@@ -154,7 +158,7 @@ path = "{}.rs""#,
154
158
Command :: new ( "cargo" )
155
159
. args ( & [ "clippy" , "--manifest-path" , CLIPPY_CARGO_TOML_PATH ] )
156
160
. args ( RUSTC_COLOR_ARGS )
157
- . args ( & [ "--" , "-D" , "warnings" , "-D" , "clippy::float_cmp" ] )
161
+ . args ( & [ "--" , "-D" , "warnings" , "-D" , "clippy::float_cmp" ] )
158
162
. output ( )
159
163
}
160
164
}
0 commit comments