mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Cleanup the File::open_mode call.
This commit is contained in:
parent
30c66debb0
commit
5c3b8f99d1
1 changed files with 3 additions and 7 deletions
|
@ -93,13 +93,9 @@ fn parse_lists(file: &String, servo_args: &[String], render_mode: RenderMode) ->
|
||||||
let mut tests = Vec::new();
|
let mut tests = Vec::new();
|
||||||
let mut next_id = 0;
|
let mut next_id = 0;
|
||||||
let file_path = Path::new(file.clone());
|
let file_path = Path::new(file.clone());
|
||||||
let contents: String = match File::open_mode(&file_path, io::Open, io::Read)
|
let contents = File::open_mode(&file_path, io::Open, io::Read)
|
||||||
.and_then(|mut f| {
|
.and_then(|mut f| f.read_to_string())
|
||||||
f.read_to_string()
|
.ok().expect("Could not read file");
|
||||||
}) {
|
|
||||||
Ok(s) => s,
|
|
||||||
_ => fail!("Could not read file"),
|
|
||||||
};
|
|
||||||
|
|
||||||
for line in contents.as_slice().lines() {
|
for line in contents.as_slice().lines() {
|
||||||
// ignore comments or empty lines
|
// ignore comments or empty lines
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue