Skip to content

[cargo fix] identity_conversion removes parenthesis with inner expression, that needs them. #4750

@soruh

Description

@soruh

When running cargo fix --clippy -Z unstable-options the following happens:

This

let int_c = i32::from(int_a + int_b) * 3;

will be turned into this

let int_c = int_a + int_b * 3;

, which is obviously incorrect.
It should instead be turned into this:

let int_c = (int_a + int_b) * 3;

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-suggestionLint: Improving, adding or fixing lint suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions