Skip to content

Commit

Permalink
Replace tempdir with tempfile
Browse files Browse the repository at this point in the history
Summary:
`tempdir` has been deprecated since 2018:
rust-lang-deprecated/tempdir#46

It's functionality was merged into `tempfile` with minor tweaks:

- Methods names: `new` -> `with_prefix`, `new_in` -> `with_prefix_in`.
- `with_prefix_in`'s args order is reversed.
- Temp dirs no longer have a period between the prefix and the random
  name (before `foo.123abc`, now `foo123abc`).

Reviewed By: capickett

Differential Revision: D50514209

fbshipit-source-id: a50e9f1c0c78a2642bae8edbb6098b3f04c89969
  • Loading branch information
zertosh authored and facebook-github-bot committed Oct 21, 2023
1 parent e9b2133 commit 9bd0337
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion shed/chrome_trace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ zstd = { version = "0.13", features = ["experimental", "zstdmt"] }

[dev-dependencies]
maplit = "1.0"
tempdir = "0.3"
tempfile = "3.5"
6 changes: 3 additions & 3 deletions shed/chrome_trace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ mod tests {
trace.add_event(begin.clone());
trace.add_event(end.clone());

let tmp = tempdir::TempDir::new("trace-event").unwrap();
let tmp = tempfile::TempDir::with_prefix("trace-event.").unwrap();
let path = tmp.path().join("trace.json");

trace.save(&path).expect("Failed to save trace");
Expand Down Expand Up @@ -627,7 +627,7 @@ mod tests {
trace.add_event(begin.clone());
trace.add_event(end.clone());

let tmp = tempdir::TempDir::new("trace-event").unwrap();
let tmp = tempfile::TempDir::with_prefix("trace-event.").unwrap();
let path = tmp.path().join("trace.json.gz");

trace.save_gzip(&path).expect("Failed to save trace");
Expand Down Expand Up @@ -661,7 +661,7 @@ mod tests {
trace.add_event(begin.clone());
trace.add_event(end.clone());

let tmp = tempdir::TempDir::new("trace-event").unwrap();
let tmp = tempfile::TempDir::with_prefix("trace-event.").unwrap();
let path = tmp.path().join("trace.json.zst");

trace.save_zstd(&path).expect("Failed to save trace");
Expand Down

0 comments on commit 9bd0337

Please sign in to comment.