Skip to content

Commit ee6d959

Browse files
committed
Fix case warning on derived properties
When deriving `Properties`, the compiler sometimes complains of the non-Camel-case `Foo_build`. This fixes the issue.
1 parent 5e683b7 commit ee6d959

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/yew-macro/src/derive_props/builder.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ impl PropsBuilder<'_> {
120120
.filter(|pf| pf.is_required())
121121
.map(|pf| pf.to_step_name(prefix))
122122
.collect();
123-
step_names.push(Ident::new(&format!("{}_build", prefix), Span::call_site()));
123+
step_names.push(Ident::new(
124+
&format!("{}PropsBuilder", prefix),
125+
prefix.span(),
126+
));
124127
step_names
125128
}
126129

packages/yew-macro/tests/props_macro/props-fail.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ error[E0609]: no field `fail` on type `Props`
3030
|
3131
= note: available fields are: `a`
3232

33-
error[E0599]: no method named `fail` found for struct `PropsBuilder<PropsBuilderStep_build>` in the current scope
33+
error[E0599]: no method named `fail` found for struct `PropsBuilder<PropsBuilderStepPropsBuilder>` in the current scope
3434
--> $DIR/props-fail.rs:10:31
3535
|
3636
3 | #[derive(Clone, Properties)]
3737
| ---------- method `fail` not found for this
3838
...
3939
10 | yew::props!(Props { a: 5, fail: 10 });
40-
| ^^^^ method not found in `PropsBuilder<PropsBuilderStep_build>`
40+
| ^^^^ method not found in `PropsBuilder<PropsBuilderStepPropsBuilder>`
4141

4242
error[E0609]: no field `does_not_exist` on type `Props`
4343
--> $DIR/props-fail.rs:15:25

0 commit comments

Comments
 (0)