mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-12-28 06:49:19 +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);
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Error reading file: {}", e);
|
||||
assert!(false);
|
||||
panic!("Error reading file.");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,11 +48,11 @@ fn main() {
|
||||
fn create_required_files(){
|
||||
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.
|
||||
This is the second 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.");
|
||||
}
|
||||
|
||||
|
||||
@ -33,17 +33,17 @@ fn create_required_files(){
|
||||
|
||||
let dir_path = file_path.parent().unwrap();
|
||||
|
||||
if dir_path.exists() == false {
|
||||
if !dir_path.exists() {
|
||||
fs::create_dir(dir_path).unwrap();
|
||||
println!("Created directory {:?}", dir_path);
|
||||
}
|
||||
|
||||
if file_path.exists() == false {
|
||||
if !file_path.exists(){
|
||||
|
||||
let text = "This is the first line of the text.
|
||||
This is the second 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.");
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user