Skip to content

Commit

Permalink
fix: Report file close errors
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Oct 10, 2024
1 parent bb5060c commit f2616f2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use serde_derive::Serialize;
use std::error::Error;
use std::fmt::Write as FmtWrite;
use std::mem;
use std::{env, fs::File, io::Write, path::Path, path::PathBuf};
use std::{env, path::Path, path::PathBuf};
use uuid::Uuid;

/// Method of failure.
Expand Down Expand Up @@ -68,9 +68,8 @@ impl Report {
let tmp_dir = env::temp_dir();
let file_name = format!("report-{}.toml", &uuid);
let file_path = Path::new(&tmp_dir).join(file_name);
let mut file = File::create(&file_path)?;
let toml = self.serialize().expect("only using toml-compatible types");
file.write_all(toml.as_bytes())?;
std::fs::write(&file_path, toml.as_bytes())?;
Ok(file_path)
}
}
Expand Down

0 comments on commit f2616f2

Please sign in to comment.