Skip to content

Commit

Permalink
Fix wrong delimiter around attributes (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
elichai authored Oct 17, 2023
1 parent 6bbe14c commit e075a75
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/generate/generate_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl<'a> GenConst<'a> {
builder
.punct('#')
.punct('!')
.group(Delimiter::Brace, |builder| {
.group(Delimiter::Bracket, |builder| {
builder.push_parsed(attr)?;
Ok(())
})?;
Expand Down Expand Up @@ -350,7 +350,7 @@ impl<'a, P: FnParent> FnBuilder<'a, P> {

// attrs
for attr in attrs {
builder.punct('#').group(Delimiter::Brace, |builder| {
builder.punct('#').group(Delimiter::Bracket, |builder| {
builder.push_parsed(attr)?;
Ok(())
})?;
Expand Down
2 changes: 1 addition & 1 deletion src/generate/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<'a, P: Parent> Impl<'a, P> {
/// Add a outer attribute to the trait implementation
pub fn impl_outer_attr(&mut self, attr: impl AsRef<str>) -> Result {
let mut builder = StreamBuilder::new();
builder.punct('#').group(Delimiter::Brace, |builder| {
builder.punct('#').group(Delimiter::Bracket, |builder| {
builder.push_parsed(attr)?;
Ok(())
})?;
Expand Down
2 changes: 1 addition & 1 deletion src/generate/impl_for.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<'a, P: Parent> ImplFor<'a, P> {
/// Add a outer attribute to the trait implementation
pub fn impl_outer_attr(&mut self, attr: impl AsRef<str>) -> Result {
let mut builder = StreamBuilder::new();
builder.punct('#').group(Delimiter::Brace, |builder| {
builder.punct('#').group(Delimiter::Bracket, |builder| {
builder.push_parsed(attr)?;
Ok(())
})?;
Expand Down
1 change: 1 addition & 0 deletions test/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ fn derive_ret_hi_inner(input: TokenStream) -> Result<TokenStream> {
generator
.generate_impl()
.generate_fn("hi")
.with_attr("inline(never)")
.with_self_arg(FnSelfArg::RefSelf)
.with_return_type("&'static str")
.body(|body| {
Expand Down

0 comments on commit e075a75

Please sign in to comment.