From fde2424b398dadd2310686b365041189decd1d63 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Thu, 26 Mar 2020 14:56:41 +0000 Subject: Remove `fs::read_to_string` reimplementations After two previous PRs already removed some instances of reimplementations of the `fs::read_to_string` functionality, this removes the last remaining occurence and with it all instances of `File::open`. So this should remove them all for good. --- alacritty_terminal/src/term/mod.rs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'alacritty_terminal/src') diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index 84a53eeb..65c2899e 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -2663,8 +2663,7 @@ mod benches { extern crate serde_json as json; extern crate test; - use std::fs::File; - use std::io::Read; + use std::fs; use std::mem; use std::path::Path; @@ -2681,16 +2680,6 @@ mod benches { fn send_event(&self, _event: Event) {} } - fn read_string

(path: P) -> String - where - P: AsRef, - { - let mut res = String::new(); - File::open(path.as_ref()).unwrap().read_to_string(&mut res).unwrap(); - - res - } - /// Benchmark for the renderable cells iterator /// /// The renderable cells iterator yields cells that require work to be @@ -2703,14 +2692,16 @@ mod benches { #[bench] fn render_iter(b: &mut test::Bencher) { // Need some realistic grid state; using one of the ref files. - let serialized_grid = read_string(concat!( + let serialized_grid = fs::read_to_string(concat!( env!("CARGO_MANIFEST_DIR"), "/tests/ref/vim_large_window_scroll/grid.json" - )); - let serialized_size = read_string(concat!( + )) + .unwrap(); + let serialized_size = fs::read_to_string(concat!( env!("CARGO_MANIFEST_DIR"), "/tests/ref/vim_large_window_scroll/size.json" - )); + )) + .unwrap(); let mut grid: Grid = json::from_str(&serialized_grid).unwrap(); let size: SizeInfo = json::from_str(&serialized_size).unwrap(); -- cgit