Avoid accidental copy of static var before creating mut ref
This commit is contained in:
parent
2f750a82bf
commit
114dda2fd1
1 changed files with 2 additions and 2 deletions
|
@ -142,7 +142,7 @@ impl RccInfo {
|
|||
// Use .get_mut instead of []-operator so that we control how bounds checks happen.
|
||||
// Otherwise, core::fmt will be pulled in here in order to format the integer in the
|
||||
// out-of-bounds error.
|
||||
if let Some(refcount) = unsafe { crate::_generated::REFCOUNTS }.get_mut(refcount_idx) {
|
||||
if let Some(refcount) = unsafe { crate::_generated::REFCOUNTS.get_mut(refcount_idx) } {
|
||||
*refcount += 1;
|
||||
if *refcount > 1 {
|
||||
return;
|
||||
|
@ -206,7 +206,7 @@ impl RccInfo {
|
|||
// Use .get_mut instead of []-operator so that we control how bounds checks happen.
|
||||
// Otherwise, core::fmt will be pulled in here in order to format the integer in the
|
||||
// out-of-bounds error.
|
||||
if let Some(refcount) = unsafe { crate::_generated::REFCOUNTS }.get_mut(refcount_idx) {
|
||||
if let Some(refcount) = unsafe { crate::_generated::REFCOUNTS.get_mut(refcount_idx) } {
|
||||
*refcount -= 1;
|
||||
if *refcount > 0 {
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue