diff options
author | Jan Beich <jbeich@FreeBSD.org> | 2015-12-14 03:13:40 +0000 |
---|---|---|
committer | Jan Beich <jbeich@FreeBSD.org> | 2015-12-14 03:13:40 +0000 |
commit | 92328d9093fe2d62822f56149b9ff9c8fa097959 (patch) | |
tree | 51654622339bb77dcd8ef40bad72c5de62bc2097 /src | |
parent | b35927f24779a4d2ea9212c3c3000daf50027d63 (diff) |
Move CString to where it's actually used
src/feature/xattr.rs:6:5: 6:22 warning: unused import, #[warn(unused_imports)] on by default
src/feature/xattr.rs:6 use std::ffi::CString;
^~~~~~~~~~~~~~~~~
Diffstat (limited to 'src')
-rw-r--r-- | src/feature/xattr.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/feature/xattr.rs b/src/feature/xattr.rs index 8682087..c705d1d 100644 --- a/src/feature/xattr.rs +++ b/src/feature/xattr.rs @@ -3,7 +3,6 @@ extern crate libc; use std::io; use std::path::Path; -use std::ffi::CString; pub const ENABLED: bool = cfg!(feature="git") && cfg!(any(target_os="macos", target_os="linux")); @@ -51,6 +50,8 @@ pub struct Attribute { #[cfg(any(target_os = "macos", target_os = "linux"))] pub fn list_attrs(lister: lister::Lister, path: &Path) -> io::Result<Vec<Attribute>> { + use std::ffi::CString; + let c_path = match path.to_str().and_then(|s| { CString::new(s).ok() }) { Some(cstring) => cstring, None => return Err(io::Error::new(io::ErrorKind::Other, "Error: path somehow contained a NUL?")), |