File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,27 @@ pub fn init() -> Result<()> {
35
35
. stdin ( Stdio :: null ( ) )
36
36
. stderr ( Stdio :: null ( ) )
37
37
. output ( )
38
- . context ( CARGO_LOCATE_PROJECT_ERR ) ?;
38
+ . context (
39
+ "Failed to run the command `cargo locate-project …`\n \
40
+ Did you already install Rust?\n \
41
+ Try running `cargo --version` to diagnose the problem.",
42
+ ) ?;
43
+
44
+ if !Command :: new ( "cargo" )
45
+ . arg ( "clippy" )
46
+ . arg ( "--version" )
47
+ . stdin ( Stdio :: null ( ) )
48
+ . stdout ( Stdio :: null ( ) )
49
+ . stderr ( Stdio :: null ( ) )
50
+ . status ( )
51
+ . context ( "Failed to run the command `cargo clippy --version`" ) ?
52
+ . success ( )
53
+ {
54
+ bail ! (
55
+ "Clippy, the official Rust linter, is missing.\n \
56
+ Please install it first before initializing Rustlings."
57
+ )
58
+ }
39
59
40
60
let mut stdout = io:: stdout ( ) . lock ( ) ;
41
61
let mut init_git = true ;
@@ -170,10 +190,6 @@ pub fn init() -> Result<()> {
170
190
Ok ( ( ) )
171
191
}
172
192
173
- const CARGO_LOCATE_PROJECT_ERR : & str = "Failed to run the command `cargo locate-project …`
174
- Did you already install Rust?
175
- Try running `cargo --version` to diagnose the problem." ;
176
-
177
193
const INIT_SOLUTION_FILE : & [ u8 ] = b"fn main() {
178
194
// DON'T EDIT THIS SOLUTION FILE!
179
195
// It will be automatically filled after you finish the exercise.
You can’t perform that action at this time.
0 commit comments