@@ -197,7 +197,7 @@ fn order_test_8() {
197197
198198#[ test]
199199fn empty ( ) {
200- error_chain ! { } ;
200+ error_chain ! { } ;
201201}
202202
203203#[ test]
@@ -251,7 +251,7 @@ fn chain_err() {
251251 let _: Result < ( ) > = Err ( Error :: from_kind ( ErrorKind :: Test ) ) . chain_err ( || "" ) ;
252252}
253253
254- /// Verify that an error chain is extended one by `Error::chain_err`, with
254+ /// Verify that an error chain is extended one by `Error::chain_err`, with
255255/// the new error added to the end.
256256#[ test]
257257fn error_chain_err ( ) {
@@ -260,10 +260,10 @@ fn error_chain_err() {
260260 Test
261261 }
262262 }
263-
263+
264264 let base = Error :: from ( ErrorKind :: Test ) ;
265265 let ext = base. chain_err ( || "Test passes" ) ;
266-
266+
267267 if let Error ( ErrorKind :: Msg ( _) , _) = ext {
268268 // pass
269269 } else {
@@ -274,7 +274,7 @@ fn error_chain_err() {
274274#[ test]
275275fn links ( ) {
276276 mod test {
277- error_chain ! { }
277+ error_chain ! { }
278278 }
279279
280280 error_chain ! {
@@ -293,15 +293,17 @@ mod foreign_link_test {
293293 // signature of the public foreign_link_error_path
294294 #[ derive( Debug ) ]
295295 pub struct ForeignError {
296- cause : ForeignErrorCause
296+ cause : ForeignErrorCause ,
297297 }
298298
299299 impl :: std:: error:: Error for ForeignError {
300300 fn description ( & self ) -> & ' static str {
301301 "Foreign error description"
302302 }
303303
304- fn cause ( & self ) -> Option < & :: std:: error:: Error > { Some ( & self . cause ) }
304+ fn cause ( & self ) -> Option < & :: std:: error:: Error > {
305+ Some ( & self . cause )
306+ }
305307 }
306308
307309 impl fmt:: Display for ForeignError {
@@ -318,7 +320,9 @@ mod foreign_link_test {
318320 "Foreign error cause description"
319321 }
320322
321- fn cause ( & self ) -> Option < & :: std:: error:: Error > { None }
323+ fn cause ( & self ) -> Option < & :: std:: error:: Error > {
324+ None
325+ }
322326 }
323327
324328 impl fmt:: Display for ForeignErrorCause {
@@ -342,43 +346,31 @@ mod foreign_link_test {
342346 #[ test]
343347 fn display_underlying_error ( ) {
344348 let chained_error = try_foreign_error ( ) . err ( ) . unwrap ( ) ;
345- assert_eq ! (
346- format!( "{}" , ForeignError { cause: ForeignErrorCause { } } ) ,
347- format!( "{}" , chained_error)
348- ) ;
349+ assert_eq ! ( format!( "{}" , ForeignError { cause: ForeignErrorCause { } } ) ,
350+ format!( "{}" , chained_error) ) ;
349351 }
350352
351353 #[ test]
352354 fn finds_cause ( ) {
353355 let chained_error = try_foreign_error ( ) . err ( ) . unwrap ( ) ;
354- assert_eq ! (
355- format!( "{}" , ForeignErrorCause { } ) ,
356- format!( "{}" , :: std:: error:: Error :: cause( & chained_error) . unwrap( ) )
357- ) ;
356+ assert_eq ! ( format!( "{}" , ForeignErrorCause { } ) ,
357+ format!( "{}" , :: std:: error:: Error :: cause( & chained_error) . unwrap( ) ) ) ;
358358 }
359359
360360 #[ test]
361361 fn iterates ( ) {
362362 let chained_error = try_foreign_error ( ) . err ( ) . unwrap ( ) ;
363363 let mut error_iter = chained_error. iter ( ) ;
364- assert_eq ! (
365- format!( "{}" , ForeignError { cause: ForeignErrorCause { } } ) ,
366- format!( "{}" , error_iter. next( ) . unwrap( ) )
367- ) ;
368- assert_eq ! (
369- format!( "{}" , ForeignErrorCause { } ) ,
370- format!( "{}" , error_iter. next( ) . unwrap( ) )
371- ) ;
372- assert_eq ! (
373- format!( "{:?}" , None as Option <& :: std:: error:: Error >) ,
374- format!( "{:?}" , error_iter. next( ) )
375- ) ;
364+ assert_eq ! ( format!( "{}" , ForeignError { cause: ForeignErrorCause { } } ) ,
365+ format!( "{}" , error_iter. next( ) . unwrap( ) ) ) ;
366+ assert_eq ! ( format!( "{}" , ForeignErrorCause { } ) ,
367+ format!( "{}" , error_iter. next( ) . unwrap( ) ) ) ;
368+ assert_eq ! ( format!( "{:?}" , None as Option <& :: std:: error:: Error >) ,
369+ format!( "{:?}" , error_iter. next( ) ) ) ;
376370 }
377371
378372 fn try_foreign_error ( ) -> Result < ( ) > {
379- try!( Err ( ForeignError {
380- cause : ForeignErrorCause { }
381- } ) ) ;
373+ try!( Err ( ForeignError { cause : ForeignErrorCause { } } ) ) ;
382374 Ok ( ( ) )
383375 }
384376}
@@ -390,9 +382,7 @@ mod attributes_test {
390382
391383 #[ cfg( not( test) ) ]
392384 mod inner {
393- error_chain ! {
394-
395- }
385+ error_chain ! { }
396386 }
397387
398388 error_chain ! {
@@ -440,7 +430,7 @@ fn without_result() {
440430#[ test]
441431fn documentation ( ) {
442432 mod inner {
443- error_chain ! { }
433+ error_chain ! { }
444434 }
445435
446436 error_chain ! {
@@ -464,13 +454,13 @@ mod multiple_error_same_mod {
464454 MyError , MyErrorKind , MyResultExt , MyResult ;
465455 }
466456 }
467- error_chain ! { }
457+ error_chain ! { }
468458}
469459
470460#[ doc( test) ]
471461#[ deny( dead_code) ]
472462mod allow_dead_code {
473- error_chain ! { }
463+ error_chain ! { }
474464}
475465
476466// Make sure links actually work!
@@ -503,8 +493,7 @@ fn error_patterns() {
503493
504494 // Tuples look nice when matching errors
505495 match Error :: from ( "Test" ) {
506- Error ( ErrorKind :: Msg ( _) , _) => {
507- }
496+ Error ( ErrorKind :: Msg ( _) , _) => { }
508497 }
509498}
510499
@@ -607,10 +596,8 @@ fn rewrapping() {
607596 NotUnicode ( _) => Err ( e) . chain_err ( || "env var was borkæ–‡å—化ã" ) ,
608597 } ) ;
609598
610- assert_eq ! (
611- format!( "{}" , our_error_a. unwrap_err( ) ) ,
612- format!( "{}" , our_error_b. unwrap_err( ) )
613- ) ;
599+ assert_eq ! ( format!( "{}" , our_error_a. unwrap_err( ) ) ,
600+ format!( "{}" , our_error_b. unwrap_err( ) ) ) ;
614601
615602}
616603
0 commit comments