Skip to content

debug_assert_with_mut_call: false positive on immutable method call #4737

Open
@taiki-e

Description

@taiki-e

Code:

pub fn f() {
    let v = &mut &mut Vec::<()>::new();
    debug_assert!(v.is_empty()); //~ ERROR do not call a function with mutable arguments inside of `debug_assert!`
}

Error:

error: do not call a function with mutable arguments inside of `debug_assert!`
  --> rust/src/lib.rs:17:19
   |
17 |     debug_assert!(v.is_empty());
   |                   ^^^^^^^^^^^^
   |
   = note: `#[deny(clippy::debug_assert_with_mut_call)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#debug_assert_with_mut_call

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.I-false-positiveIssue: The lint was triggered on code it shouldn't haveL-nurseryLint: Currently in the nursery group

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions