Skip to content

Add warning about side-effect free expression-statement #32108

Description

@LukasKalbertodt

A programming beginner could write something like

let x = 0;
x + 1;
println!("{}", x);

I would expect to see a warning about this side effect free expression statement in line 2. However, I can imagine that it could be quite hard to determine if such an expression is side effect free. After all, operators for non-standard types could have side effects, too.

Now I don't think some crazy analysis about side-effect-behavior of an expression is useful in this situation. I just thought that some very basic and specialized lints (just for primitive types for example) could be very helpful -- especially for beginners.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions