You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
leonardo-m opened this issue
Feb 8, 2017
· 3 comments
Labels
C-bugCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-middleType: Probably requires verifiying types
warning: returning the result of a let binding from a block. Consider returning the expression directly.
--> src\main.rs:16:5
|
16 | result
| ^^^^^^
|
= note: #[warn(let_and_return)] on by default
note: this expression can be directly returned
--> src\main.rs:15:18
|
15 | let result = pairwise(&bars).filter(|&(c1, c2)| is_valid(c1, c2)).count();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
But following that advice breaks the code:
error: `bars` does not live long enough
--> ...\src\main.rs:16:1
|
15 | pairwise(&bars).filter(|&(c1, c2)| is_valid(c1, c2)).count()
| ---- borrow occurs here
16 | }
| ^ `bars` dropped here while still borrowed
|
= note: values in a scope are dropped in the opposite order they are created
error: aborting due to previous error
The text was updated successfully, but these errors were encountered:
oli-obk
added
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
C-bug
Category: Clippy is not doing the correct thing
T-middle
Type: Probably requires verifiying types
labels
Feb 9, 2017
C-bugCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-middleType: Probably requires verifiying types
This is reduced code:
Clippy gives a warning:
But following that advice breaks the code:
The text was updated successfully, but these errors were encountered: