Skip to content

Commit fabdd8b

Browse files
committed
Use ? instead of deprecated try!
Rust 1.40 warned: use of deprecated item 'try': use the `?` operator instead. Rust 1.13 introduced `?`, we require Rust 1.24 as minimal version.
1 parent 505e0f4 commit fabdd8b

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

examples/iris.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl FromStr for Iris {
4444

4545
// using Iterator::by_ref()
4646
for (index, part) in parts.by_ref().take(4).enumerate() {
47-
iris.data[index] = try!(part.parse::<f32>());
47+
iris.data[index] = part.parse::<f32>()?;
4848
}
4949
if let Some(name) = parts.next() {
5050
iris.name = name.into();

src/format.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ impl<'a, I, F> fmt::Display for FormatWith<'a, I, F>
5858
};
5959

6060
if let Some(fst) = iter.next() {
61-
try!(format(fst, &mut |disp: &fmt::Display| disp.fmt(f)));
61+
format(fst, &mut |disp: &fmt::Display| disp.fmt(f))?;
6262
for elt in iter {
6363
if self.sep.len() > 0 {
6464

65-
try!(f.write_str(self.sep));
65+
f.write_str(self.sep)?;
6666
}
67-
try!(format(elt, &mut |disp: &fmt::Display| disp.fmt(f)));
67+
format(elt, &mut |disp: &fmt::Display| disp.fmt(f))?;
6868
}
6969
}
7070
Ok(())
@@ -83,12 +83,12 @@ impl<'a, I> Format<'a, I>
8383
};
8484

8585
if let Some(fst) = iter.next() {
86-
try!(cb(&fst, f));
86+
cb(&fst, f)?;
8787
for elt in iter {
8888
if self.sep.len() > 0 {
89-
try!(f.write_str(self.sep));
89+
f.write_str(self.sep)?;
9090
}
91-
try!(cb(&elt, f));
91+
cb(&elt, f)?;
9292
}
9393
}
9494
Ok(())

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ pub trait Itertools : Iterator {
18451845
II: Iterator<Item = T>,
18461846
FF: FnMut(T, T) -> T
18471847
{
1848-
let mut x = try!(inner0(it, f));
1848+
let mut x = inner0(it, f)?;
18491849
for height in 0..stop {
18501850
// Try to get another tree the same size with which to combine it,
18511851
// creating a new tree that's twice as big for next time around.

0 commit comments

Comments
 (0)