diff --git a/src/cut/cut.rs b/src/cut/cut.rs index 5ef2871bb..feaefc4aa 100644 --- a/src/cut/cut.rs +++ b/src/cut/cut.rs @@ -208,7 +208,9 @@ impl<'a> Searcher<'a> { } } -impl<'a> Iterator<(uint, uint)> for Searcher<'a> { +impl<'a> Iterator for Searcher<'a> { + type Item = (uint, uint); + fn next(&mut self) -> Option<(uint, uint)> { if self.needle.len() == 1 { for offset in range(self.position, self.haystack.len()) { diff --git a/src/cut/ranges.rs b/src/cut/ranges.rs index 2a8092fe5..8a0401ef0 100644 --- a/src/cut/ranges.rs +++ b/src/cut/ranges.rs @@ -23,19 +23,19 @@ impl std::str::FromStr for Range { match (parts.next(), parts.next()) { (Some(nm), None) => { - std::str::FromStr::from_str::(nm).and_then(|nm| if nm > 0 { Some(nm) } else { None }) + nm.parse::().and_then(|nm| if nm > 0 { Some(nm) } else { None }) .map(|nm| Range { low: nm, high: nm }) } (Some(n), Some(m)) if m.len() == 0 => { - std::str::FromStr::from_str::(n).and_then(|low| if low > 0 { Some(low) } else { None }) + n.parse::().and_then(|low| if low > 0 { Some(low) } else { None }) .map(|low| Range { low: low, high: MAX }) } (Some(n), Some(m)) if n.len() == 0 => { - std::str::FromStr::from_str::(m).and_then(|high| if high >= 1 { Some(high) } else { None }) + m.parse::().and_then(|high| if high >= 1 { Some(high) } else { None }) .map(|high| Range { low: 1, high: high }) } (Some(n), Some(m)) => { - match (std::str::FromStr::from_str::(n), std::str::FromStr::from_str::(m)) { + match (n.parse::(), m.parse::()) { (Some(low), Some(high)) if low > 0 && low <= high => { Some(Range { low: low, high: high }) } @@ -51,7 +51,7 @@ impl Range { pub fn from_list(list: &str) -> Result, String> { use std::cmp::max; - let mut ranges = vec!(); + let mut ranges : Vec = vec!(); for item in list.split(',') { match std::str::FromStr::from_str(item) { @@ -67,7 +67,7 @@ impl Range { let j = i + 1; while j < ranges.len() && ranges[j].low <= ranges[i].high { - let j_high = ranges.remove(j).unwrap().high; + let j_high = ranges.remove(j).high; ranges[i].high = max(ranges[i].high, j_high); } }