Open
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...