fix: allow equality expressions in parsing of format_args

This commit is contained in:
dfireBird 2025-11-18 09:09:32 +05:30
parent b30c688856
commit d24a6319db
No known key found for this signature in database
GPG key ID: 26D522CA5FC2B93D
2 changed files with 23 additions and 1 deletions

View file

@ -6268,6 +6268,28 @@ fn main() {
fn $0fun_name(s: &Foo) {
*print!("{}{}", s, s);
}"#,
);
}
#[test]
fn parameter_is_added_used_in_eq_expression_in_macro() {
check_assist(
extract_function,
r#"
//- minicore: fmt
fn foo() {
let v = 123;
$0print!("{v:?}{}", v == 123);$0
}"#,
r#"
fn foo() {
let v = 123;
fun_name(v);
}
fn $0fun_name(v: i32) {
print!("{v:?}{}", v == 123);
}"#,
);
}

View file

@ -283,7 +283,7 @@ fn builtin_expr(p: &mut Parser<'_>) -> Option<CompletedMarker> {
if p.eat(T![,]) {
while !p.at(EOF) && !p.at(T![')']) {
let m = p.start();
if p.at(IDENT) && p.nth_at(1, T![=]) {
if p.at(IDENT) && p.nth_at(1, T![=]) && !p.nth_at(2, T![=]) {
name(p);
p.bump(T![=]);
}