提交 5abd5374 编写于 作者: B Ben S

Remove extraneous lifetimes

上级 a631bc09
...@@ -28,7 +28,7 @@ pub struct File<'a> { ...@@ -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> {
......
...@@ -10,13 +10,13 @@ use std::ascii::StrAsciiExt; ...@@ -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> { ...@@ -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() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册