Skip to content

Commit c96bb2c

Browse files
committed
Running rustfmt on test
1 parent 8880677 commit c96bb2c

File tree

3 files changed

+28
-18
lines changed

3 files changed

+28
-18
lines changed

tests/ui/try_err.fixed

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
// Should flag `Err(err)?`
77
pub 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
1617
pub 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.
3334
pub 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.
5053
pub 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)

tests/ui/try_err.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
// Should flag `Err(err)?`
77
pub 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
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
1617
pub 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
Err(err)?;
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.
3334
pub 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
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.
5053
pub 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
Err(err)?;
5661
}
5762
Ok(i)

tests/ui/try_err.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: returning an `Err(_)` with the `?` operator
2-
--> $DIR/try_err.rs:10:9
2+
--> $DIR/try_err.rs:11:9
33
|
44
LL | Err(err)?;
55
| ^^^^^^^^^ help: try this: `return Err(err)`
@@ -11,19 +11,19 @@ LL | #![deny(clippy::try_err)]
1111
| ^^^^^^^^^^^^^^^
1212

1313
error: returning an `Err(_)` with the `?` operator
14-
--> $DIR/try_err.rs:19:9
14+
--> $DIR/try_err.rs:21:9
1515
|
1616
LL | Err(err)?;
1717
| ^^^^^^^^^ help: try this: `return Err(err.into())`
1818

1919
error: returning an `Err(_)` with the `?` operator
20-
--> $DIR/try_err.rs:38:17
20+
--> $DIR/try_err.rs:41:17
2121
|
2222
LL | Err(err)?;
2323
| ^^^^^^^^^ help: try this: `return Err(err)`
2424

2525
error: returning an `Err(_)` with the `?` operator
26-
--> $DIR/try_err.rs:55:17
26+
--> $DIR/try_err.rs:60:17
2727
|
2828
LL | Err(err)?;
2929
| ^^^^^^^^^ help: try this: `return Err(err.into())`

0 commit comments

Comments
 (0)