rust/tests/ui/unnecessary_wrap.stderr

54 lines
1.0 KiB
Plaintext
Raw Normal View History

2020-09-20 04:22:01 -05:00
error: this function returns unnecessarily wrapping data
2020-09-22 12:57:47 -05:00
--> $DIR/unnecessary_wrap.rs:8:1
|
LL | / fn func1(a: bool, b: bool) -> Option<i32> {
LL | | if a && b {
LL | | return Some(42);
LL | | }
... |
LL | | }
LL | | }
| |_^
|
= note: `-D clippy::unnecessary-wrap` implied by `-D warnings`
help: factor this out to
|
2020-09-20 04:22:01 -05:00
LL | fn func1(a: bool, b: bool) -> i32 {
LL | if a && b {
LL | return 42;
LL | }
LL | if a {
LL | Some(-1);
...
2020-09-20 04:22:01 -05:00
error: this function returns unnecessarily wrapping data
2020-09-22 12:57:47 -05:00
--> $DIR/unnecessary_wrap.rs:39:1
|
LL | / fn func4() -> Option<i32> {
LL | | Some(1)
LL | | }
| |_^
2020-09-20 04:22:01 -05:00
|
help: factor this out to
|
LL | fn func4() -> i32 {
LL | 1
|
error: this function returns unnecessarily wrapping data
2020-09-22 12:57:47 -05:00
--> $DIR/unnecessary_wrap.rs:49:1
2020-09-20 04:22:01 -05:00
|
2020-09-20 10:11:28 -05:00
LL | / fn func6() -> Result<i32, ()> {
2020-09-20 04:22:01 -05:00
LL | | Ok(1)
LL | | }
| |_^
|
help: factor this out to
|
2020-09-20 10:11:28 -05:00
LL | fn func6() -> i32 {
2020-09-20 04:22:01 -05:00
LL | 1
|
2020-09-20 04:22:01 -05:00
error: aborting due to 3 previous errors