mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-12-28 10:40:48 +00:00
Avoid unstable c_string conversion features
This commit is contained in:
parent
b3e3825417
commit
e8ea96ee86
@ -3,7 +3,7 @@ extern crate libc;
|
|||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::ffi::CString;
|
||||||
|
|
||||||
pub const ENABLED: bool = cfg!(feature="git") && cfg!(any(target_os="macos", target_os="linux"));
|
pub const ENABLED: bool = cfg!(feature="git") && cfg!(any(target_os="macos", target_os="linux"));
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ pub struct Attribute {
|
|||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
||||||
pub fn list_attrs(lister: lister::Lister, path: &Path) -> io::Result<Vec<Attribute>> {
|
pub fn list_attrs(lister: lister::Lister, path: &Path) -> io::Result<Vec<Attribute>> {
|
||||||
let c_path = match path.as_os_str().to_cstring() {
|
let c_path = match path.to_str().and_then(|s| { CString::new(s).ok() }) {
|
||||||
Some(cstring) => cstring,
|
Some(cstring) => cstring,
|
||||||
None => return Err(io::Error::new(io::ErrorKind::Other, "Error: path somehow contained a NUL?")),
|
None => return Err(io::Error::new(io::ErrorKind::Other, "Error: path somehow contained a NUL?")),
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#![feature(convert)]
|
|
||||||
|
|
||||||
#![warn(trivial_casts, trivial_numeric_casts)]
|
#![warn(trivial_casts, trivial_numeric_casts)]
|
||||||
#![warn(unused_extern_crates, unused_qualifications)]
|
#![warn(unused_extern_crates, unused_qualifications)]
|
||||||
#![warn(unused_results)]
|
#![warn(unused_results)]
|
||||||
|
Loading…
Reference in New Issue
Block a user