Skip to content

closure parameters get warned "unused variable" when they are only used in a nested closure #21386

@mi2ebi

Description

@mi2ebi

rust-analyzer version: rust-analyzer 1.94.0-nightly (fcd6309 2025-12-28)

rustc version: rustc 1.94.0-nightly (fcd630976 2026-01-01)

editor or extension: Helix and Emacs

relevant settings:

[language-server.rust-analyzer.config]
check.overrideCommand = ["cargo", "xnitpick"]
# check.overrideCommand = ["cargo", "clippy"]
cargo.features = "all"
diagnostics = {experimental.enable = true, styleLints.enable = true}
inlayHints = {closureCaptureHints.enable = true, closureReturnTypeHints.enable = "always"}

and identical settings in Emacs

repository link (if public, optional): https://github.com/latkerlo/latkerlo-jvotci/blob/main/rs/src/tarmi.rs line 148

code snippet to reproduce:

fn main() {
    let f = |x: i32| move |y| x == y;
    assert!(f(2)(4i32.isqrt()));
}

helix:

Image

manually calling rust-analyzer:

Image

emacs:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsdiagnostics / error reportingA-mirBroken WindowBugs / technical debt to be addressed immediatelyC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions