Skip to content

Commit 7651a05

Browse files
committed
🎨 Minor changes
1 parent 0973420 commit 7651a05

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/lib.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ impl ToTokens for Member {
467467
let this = value;
468468
#into
469469
};
470+
#[allow(unused_comparisons)]
470471
debug_assert!(value <= #mask, "value out of bounds");
471472
Self(self.0 & !(#mask << #offset) | (value & #mask) << #offset)
472473
}
@@ -558,6 +559,7 @@ fn parse_field(attrs: &[syn::Attribute], ty: &syn::Type, ignore: bool) -> syn::R
558559
meta: syn::Meta::List(syn::MetaList { path, tokens, .. }),
559560
..
560561
} if path.is_ident("bits") => {
562+
let span = tokens.span();
561563
let BitsAttr {
562564
bits,
563565
default,
@@ -567,10 +569,10 @@ fn parse_field(attrs: &[syn::Attribute], ty: &syn::Type, ignore: bool) -> syn::R
567569

568570
if let Some(bits) = bits {
569571
if bits == 0 {
570-
return Err(syn::Error::new(tokens.span(), "bits cannot bit 0"));
572+
return Err(syn::Error::new(span, "bits cannot bit 0"));
571573
}
572574
if ty_bits != 0 && bits > ty_bits {
573-
return Err(syn::Error::new(tokens.span(), "overflowing field type"));
575+
return Err(syn::Error::new(span, "overflowing field type"));
574576
}
575577
ret.bits = bits;
576578
}
@@ -607,7 +609,7 @@ fn parse_field(attrs: &[syn::Attribute], ty: &syn::Type, ignore: bool) -> syn::R
607609
));
608610
}
609611

610-
// Negative integers need some special handling...
612+
// Signed integers need some special handling...
611613
if !ignore && class == TypeClass::SInt {
612614
let bits = ret.bits as u32;
613615
let mask: u128 = !0 >> (u128::BITS - ret.bits as u32);

0 commit comments

Comments
 (0)