From c96bb2c30307ec08443b37b905becba93de28259 Mon Sep 17 00:00:00 2001 From: Joe Frikker Date: Sun, 30 Jun 2019 18:28:12 -0400 Subject: [PATCH] Running rustfmt on test --- tests/ui/try_err.fixed | 19 ++++++++++++------- tests/ui/try_err.rs | 19 ++++++++++++------- tests/ui/try_err.stderr | 8 ++++---- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/tests/ui/try_err.fixed b/tests/ui/try_err.fixed index fe4be727be1..117300e84a4 100644 --- a/tests/ui/try_err.fixed +++ b/tests/ui/try_err.fixed @@ -6,7 +6,8 @@ // Should flag `Err(err)?` pub fn basic_test() -> Result { let err: i32 = 1; - if true { // To avoid warnings during rustfix + // To avoid warnings during rustfix + if true { return Err(err); } Ok(0) @@ -15,7 +16,8 @@ pub fn basic_test() -> Result { // Tests that `.into()` is added when appropriate pub fn into_test() -> Result { let err: u8 = 1; - if true { // To avoid warnings during rustfix + // To avoid warnings during rustfix + if true { return Err(err.into()); } Ok(0) @@ -26,15 +28,16 @@ pub fn negative_test() -> Result { Ok(nested_error()? + 1) } - // Tests that `.into()` isn't added when the error type // matches the surrounding closure's return type, even // when it doesn't match the surrounding function's. pub fn closure_matches_test() -> Result { - let res: Result = Some(1).into_iter() + let res: Result = Some(1) + .into_iter() .map(|i| { let err: i8 = 1; - if true { // To avoid warnings during rustfix + // To avoid warnings during rustfix + if true { return Err(err); } Ok(i) @@ -48,10 +51,12 @@ pub fn closure_matches_test() -> Result { // Tests that `.into()` isn't added when the error type // doesn't match the surrounding closure's return type. pub fn closure_into_test() -> Result { - let res: Result = Some(1).into_iter() + let res: Result = Some(1) + .into_iter() .map(|i| { let err: i8 = 1; - if true { // To avoid warnings during rustfix + // To avoid warnings during rustfix + if true { return Err(err.into()); } Ok(i) diff --git a/tests/ui/try_err.rs b/tests/ui/try_err.rs index c72f88da8e3..828cf639a1b 100644 --- a/tests/ui/try_err.rs +++ b/tests/ui/try_err.rs @@ -6,7 +6,8 @@ // Should flag `Err(err)?` pub fn basic_test() -> Result { let err: i32 = 1; - if true { // To avoid warnings during rustfix + // To avoid warnings during rustfix + if true { Err(err)?; } Ok(0) @@ -15,7 +16,8 @@ pub fn basic_test() -> Result { // Tests that `.into()` is added when appropriate pub fn into_test() -> Result { let err: u8 = 1; - if true { // To avoid warnings during rustfix + // To avoid warnings during rustfix + if true { Err(err)?; } Ok(0) @@ -26,15 +28,16 @@ pub fn negative_test() -> Result { Ok(nested_error()? + 1) } - // Tests that `.into()` isn't added when the error type // matches the surrounding closure's return type, even // when it doesn't match the surrounding function's. pub fn closure_matches_test() -> Result { - let res: Result = Some(1).into_iter() + let res: Result = Some(1) + .into_iter() .map(|i| { let err: i8 = 1; - if true { // To avoid warnings during rustfix + // To avoid warnings during rustfix + if true { Err(err)?; } Ok(i) @@ -48,10 +51,12 @@ pub fn closure_matches_test() -> Result { // Tests that `.into()` isn't added when the error type // doesn't match the surrounding closure's return type. pub fn closure_into_test() -> Result { - let res: Result = Some(1).into_iter() + let res: Result = Some(1) + .into_iter() .map(|i| { let err: i8 = 1; - if true { // To avoid warnings during rustfix + // To avoid warnings during rustfix + if true { Err(err)?; } Ok(i) diff --git a/tests/ui/try_err.stderr b/tests/ui/try_err.stderr index 2d095f1b6e0..dbe05ce5178 100644 --- a/tests/ui/try_err.stderr +++ b/tests/ui/try_err.stderr @@ -1,5 +1,5 @@ error: returning an `Err(_)` with the `?` operator - --> $DIR/try_err.rs:10:9 + --> $DIR/try_err.rs:11:9 | LL | Err(err)?; | ^^^^^^^^^ help: try this: `return Err(err)` @@ -11,19 +11,19 @@ LL | #![deny(clippy::try_err)] | ^^^^^^^^^^^^^^^ error: returning an `Err(_)` with the `?` operator - --> $DIR/try_err.rs:19:9 + --> $DIR/try_err.rs:21:9 | LL | Err(err)?; | ^^^^^^^^^ help: try this: `return Err(err.into())` error: returning an `Err(_)` with the `?` operator - --> $DIR/try_err.rs:38:17 + --> $DIR/try_err.rs:41:17 | LL | Err(err)?; | ^^^^^^^^^ help: try this: `return Err(err)` error: returning an `Err(_)` with the `?` operator - --> $DIR/try_err.rs:55:17 + --> $DIR/try_err.rs:60:17 | LL | Err(err)?; | ^^^^^^^^^ help: try this: `return Err(err.into())`