Skip to content

Commit 9cad274

Browse files
bors[bot]burrbull
andauthored
Merge #570
570: don't cast if not use_mask r=adamgreig a=burrbull #537 Co-authored-by: Andrey Zgarbul <[email protected]>
2 parents 3f06e12 + c9f72a0 commit 9cad274

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### Fixed
1111

12+
- Don't cast if field same type as register
1213
- Parenthesizing `#offset_calc` to avoid clippy's warning of operator precedence
1314
- Replace suffix in fields' name before converting to snake case when generating methods #563
1415

src/generate/register.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ pub fn fields(
408408
}
409409
} else {
410410
quote! {
411-
self.bits #cast
411+
self.bits
412412
}
413413
};
414414

@@ -436,7 +436,7 @@ pub fn fields(
436436
}
437437
} else {
438438
quote! {
439-
self.bits #cast
439+
self.bits
440440
}
441441
};
442442
let name_sc_n = Ident::new(
@@ -720,7 +720,7 @@ pub fn fields(
720720
let op = if use_mask {
721721
quote!{ self.w.bits = (self.w.bits & !#hexmask) | (value as #rty & #hexmask); }
722722
} else {
723-
quote!{ self.w.bits = value as #rty; }
723+
quote!{ self.w.bits = value; }
724724
};
725725

726726
quote! {

0 commit comments

Comments
 (0)