- Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
L-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions
Description
The version of clippy is 0.0.212.
Here's an example:
pub fn func() { // This need to be called first always. let mut ret = foo1(); if cond() { // Overwrite with some complex expr. ret = (foo2() * 2).to_string().len() as _; } baz(ret) }It suggest writing let <mut> ret = if cond() { .. foo2() .. } else { foo1() };, which cause 3 function calls (may have side-effects) being reordered, and foo1() not always being called.
Well, I'm not sure how to write make it more idiomatic in this case...
jwodder
Metadata
Metadata
Assignees
Labels
L-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions