diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs index a099b0d..4526020 100644 --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. use std::collections::HashMap; -use std::fs::File; +use std::fs; use std::hash::BuildHasherDefault; -use std::io::{self, Read}; +use std::io; use std::mem::size_of; use std::path::PathBuf; use std::ptr; @@ -1321,7 +1321,7 @@ fn create_shader( let source = if let Some(src) = source { src } else { - from_disk = read_file(path)?; + from_disk = fs::read_to_string(path)?; &from_disk[..] }; @@ -1400,14 +1400,6 @@ fn get_shader_info_log(shader: GLuint) -> String { String::from_utf8(buf).unwrap() } -fn read_file(path: &str) -> Result { - let mut f = File::open(path)?; - let mut buf = String::new(); - f.read_to_string(&mut buf)?; - - Ok(buf) -} - #[derive(Debug)] pub enum ShaderCreationError { /// Error reading file