Skip to content

Symbols after question mark is duplicated #985

Closed
@JIghtuse

Description

@JIghtuse

When you run rustfmt on a code with question mark, it duplicate symbols after it. For example, this:

#![feature(question_mark)]

fn foo() -> Result<i32, &'static str> {
    Ok(3)
}

fn bar() -> Result<i32, &'static str> {
    Ok(foo()?.pow(2))                                 // <- one dot
}

fn main() {
    println!("{:?}", bar());
}

Will become this:

#![feature(question_mark)]

fn foo() -> Result<i32, &'static str> {
    Ok(3)
}

fn bar() -> Result<i32, &'static str> {
    Ok(foo()?..pow(2))                                 // <- two dots
}

fn main() {
    println!("{:?}", bar());
}

Life example: https://is.gd/jo9cQ9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPanic, non-idempotency, invalid code, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions