mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-01 00:09:18 +00:00
Checker fixes
This commit is contained in:
parent
61824af087
commit
2b5356aab5
@ -13,8 +13,8 @@ fn main() {
|
|||||||
assert_eq!("This is the file content.", contents);
|
assert_eq!("This is the file content.", contents);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Error reading file: {}", e);
|
panic!("Error reading file.");
|
||||||
assert!(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,11 +48,11 @@ fn main() {
|
|||||||
fn create_required_files(){
|
fn create_required_files(){
|
||||||
let file_path = Path::new(TEST_FILE_NAME);
|
let file_path = Path::new(TEST_FILE_NAME);
|
||||||
|
|
||||||
if file_path.exists() == false {
|
if !file_path.exists() {
|
||||||
let text = "This is the first line of the text.
|
let text = "This is the first line of the text.
|
||||||
This is the second line.
|
This is the second line.
|
||||||
And this is the third and the last line.";
|
And this is the third and the last line.";
|
||||||
fs::write(&file_path, text).unwrap();
|
fs::write(file_path, text).unwrap();
|
||||||
println!("File created.");
|
println!("File created.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,17 +33,17 @@ fn create_required_files(){
|
|||||||
|
|
||||||
let dir_path = file_path.parent().unwrap();
|
let dir_path = file_path.parent().unwrap();
|
||||||
|
|
||||||
if dir_path.exists() == false {
|
if !dir_path.exists() {
|
||||||
fs::create_dir(dir_path).unwrap();
|
fs::create_dir(dir_path).unwrap();
|
||||||
println!("Created directory {:?}", dir_path);
|
println!("Created directory {:?}", dir_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if file_path.exists() == false {
|
if !file_path.exists(){
|
||||||
|
|
||||||
let text = "This is the first line of the text.
|
let text = "This is the first line of the text.
|
||||||
This is the second line.
|
This is the second line.
|
||||||
And this is the third and the last line.";
|
And this is the third and the last line.";
|
||||||
fs::write(&file_path, text).unwrap();
|
fs::write(file_path, text).unwrap();
|
||||||
println!("File created.");
|
println!("File created.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user