Rename conversion util; remove duplicate util in librustc_codegen_llvm.

This commit is contained in:
Corey Farwell 2018-11-29 08:09:28 -05:00
parent e9bca7a993
commit 2a91bbac5d
5 changed files with 14 additions and 26 deletions

View file

@ -116,13 +116,13 @@ pub fn rename_or_copy_remove<P: AsRef<Path>, Q: AsRef<Path>>(p: P,
}
#[cfg(unix)]
pub fn path2cstr(p: &Path) -> CString {
use std::os::unix::prelude::*;
pub fn path_to_c_string(p: &Path) -> CString {
use std::os::unix::ffi::OsStrExt;
use std::ffi::OsStr;
let p: &OsStr = p.as_ref();
CString::new(p.as_bytes()).unwrap()
}
#[cfg(windows)]
pub fn path2cstr(p: &Path) -> CString {
pub fn path_to_c_string(p: &Path) -> CString {
CString::new(p.to_str().unwrap()).unwrap()
}