mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 10:18:11 +00:00
Remove trait shim needed before Path stabilized
Now that Path has stabilized in Rust 1.5, I removed the UUPathExt trait needed to support stable, beta, and nightly.
This commit is contained in:
parent
0678332a1f
commit
bde309a29f
1 changed files with 0 additions and 30 deletions
|
@ -7,11 +7,6 @@
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Based on the pattern using by Cargo, I created a shim over the
|
|
||||||
// standard PathExt trait, so that the unstable path methods could
|
|
||||||
// be backported to stable (<= 1.1). This will likely be dropped
|
|
||||||
// when the path trait stabilizes.
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use super::libc;
|
use super::libc;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
@ -19,31 +14,6 @@ use std::fs;
|
||||||
use std::io::{Error, ErrorKind, Result};
|
use std::io::{Error, ErrorKind, Result};
|
||||||
use std::path::{Component, Path, PathBuf};
|
use std::path::{Component, Path, PathBuf};
|
||||||
|
|
||||||
pub trait UUPathExt {
|
|
||||||
fn uu_exists(&self) -> bool;
|
|
||||||
fn uu_is_file(&self) -> bool;
|
|
||||||
fn uu_is_dir(&self) -> bool;
|
|
||||||
fn uu_metadata(&self) -> Result<fs::Metadata>;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl UUPathExt for Path {
|
|
||||||
fn uu_exists(&self) -> bool {
|
|
||||||
fs::metadata(self).is_ok()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn uu_is_file(&self) -> bool {
|
|
||||||
fs::metadata(self).map(|m| m.is_file()).unwrap_or(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn uu_is_dir(&self) -> bool {
|
|
||||||
fs::metadata(self).map(|m| m.is_dir()).unwrap_or(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn uu_metadata(&self) -> Result<fs::Metadata> {
|
|
||||||
fs::metadata(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub enum CanonicalizeMode {
|
pub enum CanonicalizeMode {
|
||||||
None,
|
None,
|
||||||
|
|
Loading…
Reference in a new issue