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<()> {
3535 . stdin ( Stdio :: null ( ) )
3636 . stderr ( Stdio :: null ( ) )
3737 . 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+ }
3959
4060 let mut stdout = io:: stdout ( ) . lock ( ) ;
4161 let mut init_git = true ;
@@ -170,10 +190,6 @@ pub fn init() -> Result<()> {
170190 Ok ( ( ) )
171191}
172192
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-
177193const INIT_SOLUTION_FILE : & [ u8 ] = b"fn main() {
178194 // DON'T EDIT THIS SOLUTION FILE!
179195 // It will be automatically filled after you finish the exercise.
You can’t perform that action at this time.
0 commit comments