220
220
//! }
221
221
//!
222
222
//! fn openfile(path: &Path) -> Result<(), Error> {
223
- //! try!( File::open(path).context(path)) ;
223
+ //! File::open(path).context(path)? ;
224
224
//!
225
225
//! // If we didn't have context, the line above would be written as;
226
226
//! //
227
- //! // try!( File::open(path)
228
- //! // .map_err(|err| Error::File(path.to_path_buf(), err))) ;
227
+ //! // File::open(path)
228
+ //! // .map_err(|err| Error::File(path.to_path_buf(), err))? ;
229
229
//!
230
230
//! Ok(())
231
231
//! }
@@ -1206,7 +1206,7 @@ mod test {
1206
1206
#[ test]
1207
1207
fn parse_float_error ( ) {
1208
1208
fn parse_float ( s : & str ) -> Result < f32 , ContextErr > {
1209
- Ok ( try! ( s. parse ( ) . context ( s) ) )
1209
+ Ok ( s. parse ( ) . context ( s) ? )
1210
1210
}
1211
1211
assert_eq ! ( format!( "{}" , parse_float( "12ab" ) . unwrap_err( ) ) ,
1212
1212
r#"Float error "12ab": invalid float literal"# ) ;
@@ -1215,7 +1215,7 @@ mod test {
1215
1215
#[ test]
1216
1216
fn parse_int_error ( ) {
1217
1217
fn parse_int ( s : & str ) -> Result < i32 , ContextErr > {
1218
- Ok ( try! ( s. parse ( ) . context ( s) ) )
1218
+ Ok ( s. parse ( ) . context ( s) ? )
1219
1219
}
1220
1220
assert_eq ! ( format!( "{}" , parse_int( "12.5" ) . unwrap_err( ) ) ,
1221
1221
r#"Int error "12.5": invalid digit found in string"# ) ;
@@ -1236,7 +1236,7 @@ mod test {
1236
1236
fn parse_utf < P : AsRef < Path > > ( s : & [ u8 ] , p : P )
1237
1237
-> Result < ( ) , ContextErr >
1238
1238
{
1239
- try! ( :: std:: str:: from_utf8 ( s) . context ( p) ) ;
1239
+ :: std:: str:: from_utf8 ( s) . context ( p) ? ;
1240
1240
Ok ( ( ) )
1241
1241
}
1242
1242
let etext = parse_utf ( b"a\x80 \x80 " , "/etc" ) . unwrap_err ( ) . to_string ( ) ;
0 commit comments