220220//! }
221221//!
222222//! fn openfile(path: &Path) -> Result<(), Error> {
223- //! try!( File::open(path).context(path)) ;
223+ //! File::open(path).context(path)? ;
224224//!
225225//! // If we didn't have context, the line above would be written as;
226226//! //
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))? ;
229229//!
230230//! Ok(())
231231//! }
@@ -1206,7 +1206,7 @@ mod test {
12061206 #[ test]
12071207 fn parse_float_error ( ) {
12081208 fn parse_float ( s : & str ) -> Result < f32 , ContextErr > {
1209- Ok ( try! ( s. parse ( ) . context ( s) ) )
1209+ Ok ( s. parse ( ) . context ( s) ? )
12101210 }
12111211 assert_eq ! ( format!( "{}" , parse_float( "12ab" ) . unwrap_err( ) ) ,
12121212 r#"Float error "12ab": invalid float literal"# ) ;
@@ -1215,7 +1215,7 @@ mod test {
12151215 #[ test]
12161216 fn parse_int_error ( ) {
12171217 fn parse_int ( s : & str ) -> Result < i32 , ContextErr > {
1218- Ok ( try! ( s. parse ( ) . context ( s) ) )
1218+ Ok ( s. parse ( ) . context ( s) ? )
12191219 }
12201220 assert_eq ! ( format!( "{}" , parse_int( "12.5" ) . unwrap_err( ) ) ,
12211221 r#"Int error "12.5": invalid digit found in string"# ) ;
@@ -1236,7 +1236,7 @@ mod test {
12361236 fn parse_utf < P : AsRef < Path > > ( s : & [ u8 ] , p : P )
12371237 -> Result < ( ) , ContextErr >
12381238 {
1239- try! ( :: std:: str:: from_utf8 ( s) . context ( p) ) ;
1239+ :: std:: str:: from_utf8 ( s) . context ( p) ? ;
12401240 Ok ( ( ) )
12411241 }
12421242 let etext = parse_utf ( b"a\x80 \x80 " , "/etc" ) . unwrap_err ( ) . to_string ( ) ;
0 commit comments