Skip to content

Commit 7c3d02d

Browse files
committed
Fix issue with string conversions in the generated builders.
1 parent ca5ff10 commit 7c3d02d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

build.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,17 +369,14 @@ fn main() {
369369
// Derive a builder in cases of 2+ parameters.
370370
let mut item_struct = item_struct.clone();
371371
item_struct.attrs.push(parse_quote!(#[derive(bon::Builder)]));
372+
item_struct.attrs.push(parse_quote!(#[builder(on(::std::string::String, into))]));
372373
if let syn::Fields::Named(fields) = &mut item_struct.fields {
373374
for field in fields.named.iter_mut() {
374375
let Some(ident) = &field.ident else { continue };
375376
if ident == "message_id" {
376377
// By default, generate message_id
377378
field.attrs.push(parse_quote!(#[builder(default = Id::generate())]));
378379
}
379-
if field.ty == parse_quote!(String) || field.ty == parse_quote!(Option<String>) {
380-
// For strings, take impl Into<String> instead of a regular String
381-
field.attrs.push(parse_quote!(#[builder(into)]));
382-
}
383380
}
384381
}
385382

0 commit comments

Comments
 (0)