mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 14:03:35 +00:00
Auto merge of #17464 - wyatt-herkamp:fix-actix-macro, r=lnicola
Check that Expr is none before adding fixup Closes #17463
This commit is contained in:
commit
67f7eb505e
1 changed files with 15 additions and 1 deletions
|
@ -277,7 +277,7 @@ pub(crate) fn fixup_syntax(
|
||||||
},
|
},
|
||||||
ast::RecordExprField(it) => {
|
ast::RecordExprField(it) => {
|
||||||
if let Some(colon) = it.colon_token() {
|
if let Some(colon) = it.colon_token() {
|
||||||
if it.name_ref().is_some() {
|
if it.name_ref().is_some() && it.expr().is_none() {
|
||||||
append.insert(colon.into(), vec![
|
append.insert(colon.into(), vec![
|
||||||
Leaf::Ident(Ident {
|
Leaf::Ident(Ident {
|
||||||
text: "__ra_fixup".into(),
|
text: "__ra_fixup".into(),
|
||||||
|
@ -843,6 +843,20 @@ fn foo () {R {f : __ra_fixup}}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn no_fixup_record_ctor_field() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
fn foo() {
|
||||||
|
R { f: a }
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
fn foo () {R {f : a}}
|
||||||
|
"#]],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fixup_arg_list() {
|
fn fixup_arg_list() {
|
||||||
check(
|
check(
|
||||||
|
|
Loading…
Reference in a new issue