Closed
Description
When running cargo fix --clippy -Z unstable-options
the following happens:
fn function_with_side_effects_but_unit_return() {
print("This is a side-effect!");
}
This
fn some_function() -> Result<()> {
// ...
Ok(function_with_side_effects_but_unit_return())
}
will be turned into this
fn some_function() -> Result<()> {
// ...
Ok(())
}
but it should either be turned into this
fn some_function() -> Result<()> {
// ...
function_with_side_effects_but_unit_return();
Ok(())
}
or not be changed at all.
This behavior results from the unit_arg Lint, so that probably should be changed to no longer being MachineApplicable
or it's "fixing" logic should be adjusted to produce the above result.
I don't know if the "Known problems" section is used for problems when using cargo fix
, but I think while this is being looked into it might make sense to add this there.
Only tested on this version:
$ cargo clippy -V
clippy 0.0.212 (e8d5a9e 2019-10-22)
$ cargo -V
cargo 1.40.0-nightly (3a9abe3f0 2019-10-15)
$ rustc -V
rustc 1.40.0-nightly (4a8c5b20c 2019-10-23)