mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-19 09:33:36 +00:00
53 lines
1 KiB
Text
53 lines
1 KiB
Text
error: this function returns unnecessarily wrapping data
|
|
--> $DIR/unnecessary_wrap.rs:10: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
|
|
|
|
|
LL | fn func1(a: bool, b: bool) -> i32 {
|
|
LL | if a && b {
|
|
LL | return 42;
|
|
LL | }
|
|
LL | if a {
|
|
LL | Some(-1);
|
|
...
|
|
|
|
error: this function returns unnecessarily wrapping data
|
|
--> $DIR/unnecessary_wrap.rs:41:1
|
|
|
|
|
LL | / fn func4() -> Option<i32> {
|
|
LL | | Some(1)
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: factor this out to
|
|
|
|
|
LL | fn func4() -> i32 {
|
|
LL | 1
|
|
|
|
|
|
|
error: this function returns unnecessarily wrapping data
|
|
--> $DIR/unnecessary_wrap.rs:51:1
|
|
|
|
|
LL | / fn func6() -> Result<i32, ()> {
|
|
LL | | Ok(1)
|
|
LL | | }
|
|
| |_^
|
|
|
|
|
help: factor this out to
|
|
|
|
|
LL | fn func6() -> i32 {
|
|
LL | 1
|
|
|
|
|
|
|
error: aborting due to 3 previous errors
|
|
|