Remove std::fs::read_to_string reimplementation

This commit is contained in:
Matthias Krüger 2020-03-17 01:50:27 +01:00 committed by GitHub
parent e272572168
commit b48e2fc2d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 11 deletions

View File

@ -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<String, io::Error> {
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