Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completing callable fields inside struct initialization will insert parenthesis after field name #16014

Closed
dfireBird opened this issue Dec 4, 2023 · 1 comment · Fixed by #16016
Labels
A-completion autocompletion C-bug Category: bug

Comments

@dfireBird
Copy link
Contributor

When completing callable fields inside struct initialization, it will insert function calling parenthesis after field name. Regression caused by #15879

struct S {
    field: fn(),
}

fn main() {
    S {fi$0
}

Actual Behavior:

struct S {
    field: fn(),
}

fn main() {
    S {field()
}

Intended Behavior:

struct S {
    field: fn(),
}

fn main() {
    S {field
}

rust-analyzer version: 0.3.1756-standalone

rustc version: rustc 1.74.0 (79e9716c9 2023-11-13)

relevant settings: Default values no specific changes required.

@dfireBird dfireBird added the C-bug Category: bug label Dec 4, 2023
@lnicola lnicola added the A-completion autocompletion label Dec 4, 2023
@dfireBird
Copy link
Contributor Author

Found the root cause as well, the function call parenthesis are inserted regardless of whether parenthesis around the receiver inserted or not. That shouldn't be the case, the function call parenthesis is only valid if parenthesis around the receiver is inserted. I will open a PR as well for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion autocompletion C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants