Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn about explicit self-assignment #5894

Merged
merged 4 commits into from
Aug 16, 2020
Merged

Warn about explicit self-assignment #5894

merged 4 commits into from
Aug 16, 2020

Commits on Aug 16, 2020

  1. Introduce function for comparing expression values

    Introduce `eq_expr_value(cx, a, b)` as a shortcut for
    `SpanlessEq::new(cx).ignore_fn().eq_expr(cx, a, b)`.
    
    No functional changes intended.
    tmiasko committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    6afa4ef View commit details
    Browse the repository at this point in the history
  2. Rename SpanlessEq::ignore_fn to deny_side_effects

    No functional changes intended.
    tmiasko committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    9b800b1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d1dbf79 View commit details
    Browse the repository at this point in the history
  4. Warn about explicit self-assignment

    Warn about assignments where left-hand side place expression is the same
    as right-hand side value expression. For example, warn about assignment in:
    
    ```rust
    pub struct Event {
        id: usize,
        x: i32,
        y: i32,
    }
    
    pub fn copy_position(a: &mut Event, b: &Event) {
        a.x = b.x;
        a.y = a.y;
    }
    ```
    tmiasko committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    4f4abf4 View commit details
    Browse the repository at this point in the history