intellij-rust/intellij-rust

Do not add parenthesis when completing methods in closures

开放

#4,450 创建于 2019年9月25日

 (0 条评论) (1 个反应) (0 位负责人)Kotlin (376 个派生)batch import
E-easybughelp wantedsubsystem::сompletion

仓库指标

星标
 (4,526 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Environment

  • IntelliJ Rust plugin version: 0.2.106.2134-193
  • Rust toolchain version: 1.37.0 (eae3437df 2019-08-13) x86_64-apple-darwin
  • IDE name and version: CLion 2019.3 EAP (CL-193.3519.24)
  • Operating system: macOS 10.14.6

Problem description

Rust allows omitting closure parameters and use functions in closures directly:

fn multiply_by_two(input: i32) -> i32 {
    input * 2
}

fn main() {
    let _ = Some(5).map(multiply_by_two);
}

When I try co compete such method, I get extra parenthesis added which breaks compilation.

fn multiply_by_two(input: i32) -> i32 {
    input * 2
}

fn main() {
    let _ = Some(5).map(mul/*caret*/);
}

Then I press tab and expect to get the example above. Instead I get:

fn multiply_by_two(input: i32) -> i32 {
    input * 2
}

fn main() {
    let _ = Some(5).map(multiply_by_two(/*caret*/));
}

贡献者指南