Remove std::fs::read_to_string reimplementation
This commit is contained in:
parent
e272572168
commit
b48e2fc2d8
|
@ -12,9 +12,9 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs::File;
|
use std::fs;
|
||||||
use std::hash::BuildHasherDefault;
|
use std::hash::BuildHasherDefault;
|
||||||
use std::io::{self, Read};
|
use std::io;
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
@ -1321,7 +1321,7 @@ fn create_shader(
|
||||||
let source = if let Some(src) = source {
|
let source = if let Some(src) = source {
|
||||||
src
|
src
|
||||||
} else {
|
} else {
|
||||||
from_disk = read_file(path)?;
|
from_disk = fs::read_to_string(path)?;
|
||||||
&from_disk[..]
|
&from_disk[..]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1400,14 +1400,6 @@ fn get_shader_info_log(shader: GLuint) -> String {
|
||||||
String::from_utf8(buf).unwrap()
|
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)]
|
#[derive(Debug)]
|
||||||
pub enum ShaderCreationError {
|
pub enum ShaderCreationError {
|
||||||
/// Error reading file
|
/// Error reading file
|
||||||
|
|
Loading…
Reference in New Issue