As my first dive into Rust in a while, I started writing code to dump the contents of a file to a string, for later processing (right now I'm just printing it out though)
Is there a cleaner way to do this than I currently am? It seems like I'm having to be way too verbose about it, but I'm not seeing any good way to clean it up
use std::io;
use std::io::File;
use std::os;
use std::str;
fn main() {
println!("meh");
let filename = &os::args()[1];
let contents = match File::open(&Path::new(filename)).read_to_end() {
Ok(s) => str::from_utf8(s.as_slice()).expect("this shouldn't happen").to_string(),
Err(e) => "".to_string(),
};
println!("ugh {}", contents.to_string());
}