228228//! }
229229//!
230230//! fn openfile(path: &Path) -> Result<(), Error> {
231- //! try!( File::open(path).context(path)) ;
231+ //! File::open(path).context(path)? ;
232232//!
233233//! // If we didn't have context, the line above would be written as;
234234//! //
235- //! // try!( File::open(path)
236- //! // .map_err(|err| Error::File(path.to_path_buf(), err))) ;
235+ //! // File::open(path)
236+ //! // .map_err(|err| Error::File(path.to_path_buf(), err))? ;
237237//!
238238//! Ok(())
239239//! }
@@ -364,11 +364,11 @@ macro_rules! quick_error {
364364 $( #[ $meta] ) *
365365 $( $strdef) * $strname ( $internal ) ;
366366
367- impl :: std :: fmt:: Display for $strname {
368- fn fmt( & self , f: & mut :: std :: fmt:: Formatter )
369- -> :: std :: fmt:: Result
367+ impl :: core :: fmt:: Display for $strname {
368+ fn fmt( & self , f: & mut :: core :: fmt:: Formatter )
369+ -> :: core :: fmt:: Result
370370 {
371- :: std :: fmt:: Display :: fmt( & self . 0 , f)
371+ :: core :: fmt:: Display :: fmt( & self . 0 , f)
372372 }
373373 }
374374
@@ -643,9 +643,9 @@ macro_rules! quick_error {
643643 #[ allow( renamed_and_removed_lints) ]
644644 #[ allow( unused_doc_comment) ]
645645 #[ allow( unused_doc_comments) ]
646- impl :: std :: fmt:: Display for $name {
647- fn fmt( & self , fmt: & mut :: std :: fmt:: Formatter )
648- -> :: std :: fmt:: Result
646+ impl :: core :: fmt:: Display for $name {
647+ fn fmt( & self , fmt: & mut :: core :: fmt:: Formatter )
648+ -> :: core :: fmt:: Result
649649 {
650650 match * self {
651651 $(
@@ -712,17 +712,17 @@ macro_rules! quick_error {
712712 ( FIND_DISPLAY_IMPL $name: ident $item: ident: $imode: tt
713713 { display( $self_: tt) -> ( $( $exprs: tt ) * ) $( $tail: tt ) * }
714714 ) => {
715- |quick_error!( IDENT $self_) : & $name, f: & mut :: std :: fmt:: Formatter | { write!( f, $( $exprs ) * ) }
715+ |quick_error!( IDENT $self_) : & $name, f: & mut :: core :: fmt:: Formatter | { write!( f, $( $exprs ) * ) }
716716 } ;
717717 ( FIND_DISPLAY_IMPL $name: ident $item: ident: $imode: tt
718718 { display( $pattern: expr) $( $tail: tt ) * }
719719 ) => {
720- |_, f: & mut :: std :: fmt:: Formatter | { write!( f, $pattern) }
720+ |_, f: & mut :: core :: fmt:: Formatter | { write!( f, $pattern) }
721721 } ;
722722 ( FIND_DISPLAY_IMPL $name: ident $item: ident: $imode: tt
723723 { display( $pattern: expr, $( $exprs: tt ) * ) $( $tail: tt ) * }
724724 ) => {
725- |_, f: & mut :: std :: fmt:: Formatter | { write!( f, $pattern, $( $exprs ) * ) }
725+ |_, f: & mut :: core :: fmt:: Formatter | { write!( f, $pattern, $( $exprs ) * ) }
726726 } ;
727727 ( FIND_DISPLAY_IMPL $name: ident $item: ident: $imode: tt
728728 { $t: tt $( $tail: tt ) * }
@@ -734,7 +734,7 @@ macro_rules! quick_error {
734734 ( FIND_DISPLAY_IMPL $name: ident $item: ident: $imode: tt
735735 { }
736736 ) => {
737- |self_: & $name, f: & mut :: std :: fmt:: Formatter | {
737+ |self_: & $name, f: & mut :: core :: fmt:: Formatter | {
738738 write!( f, "{}" , :: std:: error:: Error :: description( self_) )
739739 }
740740 } ;
@@ -1255,7 +1255,7 @@ mod test {
12551255 #[ test]
12561256 fn parse_float_error ( ) {
12571257 fn parse_float ( s : & str ) -> Result < f32 , ContextErr > {
1258- Ok ( try! ( s. parse ( ) . context ( s) ) )
1258+ Ok ( s. parse ( ) . context ( s) ? )
12591259 }
12601260 assert_eq ! ( format!( "{}" , parse_float( "12ab" ) . unwrap_err( ) ) ,
12611261 r#"Float error "12ab": invalid float literal"# ) ;
@@ -1264,7 +1264,7 @@ mod test {
12641264 #[ test]
12651265 fn parse_int_error ( ) {
12661266 fn parse_int ( s : & str ) -> Result < i32 , ContextErr > {
1267- Ok ( try! ( s. parse ( ) . context ( s) ) )
1267+ Ok ( s. parse ( ) . context ( s) ? )
12681268 }
12691269 assert_eq ! ( format!( "{}" , parse_int( "12.5" ) . unwrap_err( ) ) ,
12701270 r#"Int error "12.5": invalid digit found in string"# ) ;
@@ -1285,7 +1285,7 @@ mod test {
12851285 fn parse_utf < P : AsRef < Path > > ( s : & [ u8 ] , p : P )
12861286 -> Result < ( ) , ContextErr >
12871287 {
1288- try! ( :: std:: str:: from_utf8 ( s) . context ( p) ) ;
1288+ :: std:: str:: from_utf8 ( s) . context ( p) ? ;
12891289 Ok ( ( ) )
12901290 }
12911291 let etext = parse_utf ( b"a\x80 \x80 " , "/etc" ) . unwrap_err ( ) . to_string ( ) ;
0 commit comments