diff --git a/src/file.rs b/src/file.rs index cd1589e..42f056f 100644 --- a/src/file.rs +++ b/src/file.rs @@ -21,9 +21,9 @@ use self::fields as f; /// once, have its file extension extracted at least once, and have its stat /// information queried at least once, so it makes sense to do all this at the /// start and hold on to all the information. -pub struct File<'a> { +pub struct File<'dir> { pub name: String, - pub dir: Option<&'a Dir>, + pub dir: Option<&'dir Dir>, pub ext: Option, pub path: PathBuf, pub stat: fs::Metadata, @@ -31,18 +31,18 @@ pub struct File<'a> { pub this: Option, } -impl<'a> File<'a> { +impl<'dir> File<'dir> { /// Create a new File object from the given Path, inside the given Dir, if /// appropriate. Paths specified directly on the command-line have no Dirs. /// /// This uses `symlink_metadata` instead of `metadata`, which doesn't /// follow symbolic links. - pub fn from_path(path: &Path, parent: Option<&'a Dir>, recurse: bool) -> io::Result> { + pub fn from_path(path: &Path, parent: Option<&'dir Dir>, recurse: bool) -> io::Result> { fs::symlink_metadata(path).map(|stat| File::with_stat(stat, path, parent, recurse)) } /// Create a new File object from the given Stat result, and other data. - pub fn with_stat(stat: fs::Metadata, path: &Path, parent: Option<&'a Dir>, recurse: bool) -> File<'a> { + pub fn with_stat(stat: fs::Metadata, path: &Path, parent: Option<&'dir Dir>, recurse: bool) -> File<'dir> { let filename = path_filename(path); // If we are recursing, then the `this` field contains a Dir object @@ -340,7 +340,7 @@ fn path_filename(path: &Path) -> String { /// ASCII lowercasing is used because these extensions are only compared /// against a pre-compiled list of extensions which are known to only exist /// within ASCII, so it's alright. -fn ext<'a>(name: &'a str) -> Option { +fn ext(name: &str) -> Option { name.rfind('.').map(|p| name[p+1..].to_ascii_lowercase()) } diff --git a/src/main.rs b/src/main.rs index 7865457..49fa51c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,16 +37,16 @@ mod output; mod term; #[cfg(not(test))] -struct Exa<'a> { +struct Exa<'dir> { count: usize, options: Options, dirs: Vec, - files: Vec>, + files: Vec>, } #[cfg(not(test))] -impl<'a> Exa<'a> { - fn new(options: Options) -> Exa<'a> { +impl<'dir> Exa<'dir> { + fn new(options: Options) -> Exa<'dir> { Exa { count: 0, options: options, @@ -67,8 +67,8 @@ impl<'a> Exa<'a> { let (thread_capacity_tx, thread_capacity_rs) = sync_channel(8 * num_cpus::get()); // Communication between consumer thread and producer threads - enum StatResult<'a> { - File(File<'a>), + enum StatResult<'dir> { + File(File<'dir>), Path(PathBuf), Error }