use std::collections::HashMap;
use std::io::{prelude::*, ErrorKind};
-use std::fs::File;
+use std::fs::{self, File};
use word_utils::{first_word, second_word};
Ok(s) => println!("Cargo.toml contents:\n{}\n-------------", s),
Err(e) => println!("Could not open Cargo.toml: {:?}", e)
}
+
+ // using std API
+ match fs::read_to_string("Cargo.toml") {
+ Ok(s) => println!("Cargo.toml contents:\n{}\n-------------", s),
+ Err(e) => println!("Could not open Cargo.toml: {:?}", e)
+ }
}
fn main() {