Skip to content

--flag=($expr) is rewritten as --flag ($expr), causing a parse error #95

@asakura

Description

@asakura

nufmt rewrites --flag=($expr) as --flag ($expr). These two are not equivalent: the = form passes $expr as the flag's value, while the space form for a bool switch sets the flag to true and treats ($expr) as an extra positional argument — which is a parse error.

Input

def do-thing [--check] { $check }
def run [--check] {
    let c: bool = $check
    do-thing --check=($c)
}

Expected (no change)

def do-thing [--check] { $check }
def run [--check] {
    let c: bool = $check
    do-thing --check=($c)
}

Actual

def do-thing [--check] { $check }
def run [--check] {
    let c = $check
    do-thing --check ($c)
}

Environment

Please run rustc --version and paste the result.

rustc 1.93.0 (254b59607 2026-01-19) (built from a source tarball)

nufmt c7eda59

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions