diff options
| author | bors <bors@rust-lang.org> | 2024-09-25 04:57:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-25 04:57:12 +0000 |
| commit | 4c62024cd5dbafb64941bded422e4fbc2a100e73 (patch) | |
| tree | d53288325071e253910a6b5ffbdef798a43a08a1 /compiler/rustc_data_structures | |
| parent | 1b5aa96d6016bafe50e071b45d4d2e3c90fd766f (diff) | |
| parent | 458537ebc0e7d893103e03450f8830061bab1b2d (diff) | |
| download | rust-4c62024cd5dbafb64941bded422e4fbc2a100e73.tar.gz rust-4c62024cd5dbafb64941bded422e4fbc2a100e73.zip | |
Auto merge of #130803 - cuviper:file-buffered, r=joshtriplett
Add `File` constructors that return files wrapped with a buffer In addition to the light convenience, these are intended to raise visibility that buffering is something you should consider when opening a file, since unbuffered I/O is a common performance footgun to Rust newcomers. ACP: https://github.com/rust-lang/libs-team/issues/446 Tracking Issue: #130804
Diffstat (limited to 'compiler/rustc_data_structures')
| -rw-r--r-- | compiler/rustc_data_structures/src/lib.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/obligation_forest/graphviz.rs | 3 |
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index a35f5b1f17d..f225684d99f 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -23,6 +23,7 @@ #![feature(cfg_match)] #![feature(core_intrinsics)] #![feature(extend_one)] +#![feature(file_buffered)] #![feature(hash_raw_entry)] #![feature(macro_metavar_expr)] #![feature(map_try_insert)] diff --git a/compiler/rustc_data_structures/src/obligation_forest/graphviz.rs b/compiler/rustc_data_structures/src/obligation_forest/graphviz.rs index 60cde9a52b4..65a24366db8 100644 --- a/compiler/rustc_data_structures/src/obligation_forest/graphviz.rs +++ b/compiler/rustc_data_structures/src/obligation_forest/graphviz.rs @@ -1,6 +1,5 @@ use std::env::var_os; use std::fs::File; -use std::io::BufWriter; use std::path::Path; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -33,7 +32,7 @@ impl<O: ForestObligation> ObligationForest<O> { let file_path = dir.as_ref().join(format!("{counter:010}_{description}.gv")); - let mut gv_file = BufWriter::new(File::create(file_path).unwrap()); + let mut gv_file = File::create_buffered(file_path).unwrap(); dot::render(&self, &mut gv_file).unwrap(); } |
