mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-12-25 17:51:10 +00:00
Remove extraneous lifetimes
This commit is contained in:
parent
a631bc099f
commit
5abd53742e
2
file.rs
2
file.rs
@ -28,7 +28,7 @@ pub struct File<'a> {
|
|||||||
pub ext: Option<&'a str>,
|
pub ext: Option<&'a str>,
|
||||||
pub path: &'a Path,
|
pub path: &'a Path,
|
||||||
pub stat: io::FileStat,
|
pub stat: io::FileStat,
|
||||||
pub parts: Vec<SortPart<'a>>,
|
pub parts: Vec<SortPart>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> File<'a> {
|
impl<'a> File<'a> {
|
||||||
|
8
sort.rs
8
sort.rs
@ -10,13 +10,13 @@ use std::ascii::StrAsciiExt;
|
|||||||
// Vec<SortPart> will automatically have natural sorting.
|
// Vec<SortPart> will automatically have natural sorting.
|
||||||
|
|
||||||
#[deriving(Eq, Ord, TotalEq, TotalOrd)]
|
#[deriving(Eq, Ord, TotalEq, TotalOrd)]
|
||||||
pub enum SortPart<'a> {
|
pub enum SortPart {
|
||||||
Numeric(u64),
|
Numeric(u64),
|
||||||
Stringular(String),
|
Stringular(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> SortPart<'a> {
|
impl SortPart {
|
||||||
pub fn from_string(is_digit: bool, slice: &'a str) -> SortPart<'a> {
|
pub fn from_string(is_digit: bool, slice: &str) -> SortPart {
|
||||||
if is_digit {
|
if is_digit {
|
||||||
Numeric(from_str::<u64>(slice).expect(slice.to_owned()))
|
Numeric(from_str::<u64>(slice).expect(slice.to_owned()))
|
||||||
} else {
|
} else {
|
||||||
@ -27,7 +27,7 @@ impl<'a> SortPart<'a> {
|
|||||||
// The logic here is taken from my question at
|
// The logic here is taken from my question at
|
||||||
// http://stackoverflow.com/q/23969191/3484614
|
// http://stackoverflow.com/q/23969191/3484614
|
||||||
|
|
||||||
pub fn split_into_parts<'a>(input: &'a str) -> Vec<SortPart<'a>> {
|
pub fn split_into_parts(input: &str) -> Vec<SortPart> {
|
||||||
let mut parts = vec![];
|
let mut parts = vec![];
|
||||||
|
|
||||||
if input.is_empty() {
|
if input.is_empty() {
|
||||||
|
Loading…
Reference in New Issue
Block a user