Skip to content

Commit 89186a7

Browse files
committed
feat: v1.12.0
1 parent a74730f commit 89186a7

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lombok-macros"
3-
version = "1.11.4"
3+
version = "1.12.0"
44
edition = "2024"
55
authors = ["root@ltpp.vip"]
66
license = "MIT"

debug/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ use lombok_macros::*;
22
use std::fmt::Debug;
33

44
#[derive(Data, Debug, Clone, DisplayDebugFormat)]
5-
struct LombokTest<'a, 'b, T: Clone + Debug> {
5+
struct LombokTest<'a, 'b, T: Clone>
6+
where
7+
T: Debug,
8+
{
69
#[get(pub(crate))]
710
#[set(pub(crate))]
811
list: Vec<String>,

src/generate/fn.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ pub fn inner_lombok_data(
168168
}
169169
})
170170
.collect();
171+
let where_clause: &Option<WhereClause> = &input.generics.where_clause;
171172
let methods: Vec<NewTokenStream> = match input.data {
172173
Data::Struct(ref s) => s
173174
.fields
@@ -179,15 +180,15 @@ pub fn inner_lombok_data(
179180
let expanded: NewTokenStream = if lifetimes.is_empty() {
180181
if type_bounds.is_empty() {
181182
quote! {
182-
impl #name {
183+
impl #name #where_clause {
183184
#(#methods)*
184185
}
185186
}
186187
} else {
187188
let type_bounds_generics: NewTokenStream = quote! { #(#type_bounds),* };
188189
let type_generics: NewTokenStream = quote! { #(#types),* };
189190
quote! {
190-
impl<#type_bounds_generics> #name<#type_generics> {
191+
impl<#type_bounds_generics> #name<#type_generics> #where_clause {
191192
#(#methods)*
192193
}
193194
}
@@ -196,15 +197,15 @@ pub fn inner_lombok_data(
196197
let lifetimes_generics: NewTokenStream = quote! { #(#lifetimes),* };
197198
if type_bounds.is_empty() {
198199
quote! {
199-
impl<#lifetimes_generics> #name<#lifetimes_generics> {
200+
impl<#lifetimes_generics> #name<#lifetimes_generics> #where_clause {
200201
#(#methods)*
201202
}
202203
}
203204
} else {
204205
let type_bounds_generics: NewTokenStream = quote! { #(#type_bounds),* };
205206
let type_generics: NewTokenStream = quote! { #(#types),* };
206207
quote! {
207-
impl<#lifetimes_generics, #type_bounds_generics> #name<#lifetimes_generics, #type_generics> {
208+
impl<#lifetimes_generics, #type_bounds_generics> #name<#lifetimes_generics, #type_generics> #where_clause {
208209
#(#methods)*
209210
}
210211
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub(crate) use syn::{
2121
GenericParam::{self},
2222
Ident, Lifetime,
2323
Type::{self},
24-
TypeParam, parse_macro_input,
24+
TypeParam, WhereClause, parse_macro_input,
2525
};
2626

2727
/// This is an example of how to use the `Lombok` procedural macro with `get` attributes.

0 commit comments

Comments
 (0)