Skip to content

SSR doesn't match function_name($a) #20519

@adaszko

Description

@adaszko

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)

Image

rustc version: (eg. output of rustc -V) rustc 1.89.0 (29483883e 2025-08-04)

editor or extension: Reproduced under both neovim and vscode.

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): https://github.com/adaszko/rust-analyzer-minrepro

code snippet to reproduce:

use ustr::{Ustr, ustr};

#[derive(Clone, PartialEq)]
pub enum Expr {
    // `--help`
    Terminal(Ustr, Option<Ustr>, usize),
}

fn foo(s: &str) -> Expr {
    Expr::Terminal(ustr(s), None, 0)
}

fn main() {
    use Expr::*;
    let terminal_expr = Terminal(ustr("--color="), None, 0);
    println!("Hello, world!");
    // Terminal(ustr($s), None, 0) ==>> foo($s)
    // Terminal($s, None, 0) ==>> foo($s)
}

Expected behavior: Triggering SSR using rule Terminal(ustr($s), None, 0) ==>> foo($s) should rewrite
let terminal_expr = Terminal(ustr("--color="), None, 0);
to
let terminal_expr = foo("--color=").

Actual behavior: Rule doesn't match the line let terminal_expr = Terminal(ustr("--color="), None, 0);.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ssrstructural search & replaceC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions