Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
elrnv committed Oct 24, 2018
1 parent e44d6c9 commit d905514
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ pub fn export_ascii(data: model::Vtk, file_path: &Path) -> Result<(), Error> {
use std::fs::File;
use writer::WriteVtk;

let mut file = File::create(file_path)?;
file.write_all(String::new().write_vtk(data).as_bytes())?;
let mut out_str = String::new();
out_str.write_vtk(data);
{
let mut file = File::create(file_path)?;
file.write_all(out_str.as_bytes())?;
}
Ok(())
}
2 changes: 1 addition & 1 deletion src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ mod write_vtk_impl {
}

fn write_buf<BO: ByteOrder>(&mut self, data: IOBuffer, err: &str) {
write!(self, "{}\n", data).expect(err)
write!(self, "{}\n", data).expect(err);
}
}
}
Expand Down

0 comments on commit d905514

Please sign in to comment.