Skip to content

Commit c839f75

Browse files
committed
🐛 Fix clippy cast warning #60
1 parent f395c8c commit c839f75

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ fn bitfield_inner(args: TokenStream, input: TokenStream) -> syn::Result<TokenStr
134134
quote! {
135135
/// Creates a new default initialized bitfield.
136136
#attr
137-
#[allow(clippy::assign_op_pattern)]
138137
#vis const fn new() -> Self {
139138
let mut this = Self(#from(0));
140139
#( #defaults )*
@@ -148,7 +147,6 @@ fn bitfield_inner(args: TokenStream, input: TokenStream) -> syn::Result<TokenStr
148147
quote! {
149148
#attr
150149
impl Default for #name {
151-
#[allow(clippy::assign_op_pattern)]
152150
fn default() -> Self {
153151
let mut this = Self(#from(0));
154152
#( #defaults )*
@@ -177,6 +175,9 @@ fn bitfield_inner(args: TokenStream, input: TokenStream) -> syn::Result<TokenStr
177175
#[repr(transparent)]
178176
#vis struct #name(#repr);
179177

178+
#[allow(unused_comparisons)]
179+
#[allow(clippy::unnecessary_cast)]
180+
#[allow(clippy::assign_op_pattern)]
180181
impl #name {
181182
#impl_new
182183

@@ -185,6 +186,9 @@ fn bitfield_inner(args: TokenStream, input: TokenStream) -> syn::Result<TokenStr
185186
#( #members )*
186187
}
187188

189+
#[allow(unused_comparisons)]
190+
#[allow(clippy::unnecessary_cast)]
191+
#[allow(clippy::assign_op_pattern)]
188192
#impl_default
189193

190194
impl From<#repr> for #name {
@@ -522,7 +526,6 @@ impl ToTokens for Member {
522526
let this = value;
523527
let value: #base_ty = #into;
524528
let mask = #base_ty::MAX >> (#base_ty::BITS - Self::#bits_ident as u32);
525-
#[allow(unused_comparisons)]
526529
if value > mask {
527530
return Err(());
528531
}

0 commit comments

Comments
 (0)