66// Should flag `Err(err)?`
77pub fn basic_test() -> Result<i32, i32> {
88 let err: i32 = 1;
9- if true { // To avoid warnings during rustfix
9+ // To avoid warnings during rustfix
10+ if true {
1011 return Err(err);
1112 }
1213 Ok(0)
@@ -15,7 +16,8 @@ pub fn basic_test() -> Result<i32, i32> {
1516// Tests that `.into()` is added when appropriate
1617pub fn into_test() -> Result<i32, i32> {
1718 let err: u8 = 1;
18- if true { // To avoid warnings during rustfix
19+ // To avoid warnings during rustfix
20+ if true {
1921 return Err(err.into());
2022 }
2123 Ok(0)
@@ -26,15 +28,16 @@ pub fn negative_test() -> Result<i32, i32> {
2628 Ok(nested_error()? + 1)
2729}
2830
29-
3031// Tests that `.into()` isn't added when the error type
3132// matches the surrounding closure's return type, even
3233// when it doesn't match the surrounding function's.
3334pub fn closure_matches_test() -> Result<i32, i32> {
34- let res: Result<i32, i8> = Some(1).into_iter()
35+ let res: Result<i32, i8> = Some(1)
36+ .into_iter()
3537 .map(|i| {
3638 let err: i8 = 1;
37- if true { // To avoid warnings during rustfix
39+ // To avoid warnings during rustfix
40+ if true {
3841 return Err(err);
3942 }
4043 Ok(i)
@@ -48,10 +51,12 @@ pub fn closure_matches_test() -> Result<i32, i32> {
4851// Tests that `.into()` isn't added when the error type
4952// doesn't match the surrounding closure's return type.
5053pub fn closure_into_test() -> Result<i32, i32> {
51- let res: Result<i32, i16> = Some(1).into_iter()
54+ let res: Result<i32, i16> = Some(1)
55+ .into_iter()
5256 .map(|i| {
5357 let err: i8 = 1;
54- if true { // To avoid warnings during rustfix
58+ // To avoid warnings during rustfix
59+ if true {
5560 return Err(err.into());
5661 }
5762 Ok(i)
0 commit comments