Avoid accidental copy of static var before creating mut ref
This commit is contained in:
parent
2f750a82bf
commit
114dda2fd1
@ -142,7 +142,7 @@ impl RccInfo {
|
|||||||
// Use .get_mut instead of []-operator so that we control how bounds checks happen.
|
// 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
|
// Otherwise, core::fmt will be pulled in here in order to format the integer in the
|
||||||
// out-of-bounds error.
|
// 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;
|
*refcount += 1;
|
||||||
if *refcount > 1 {
|
if *refcount > 1 {
|
||||||
return;
|
return;
|
||||||
@ -206,7 +206,7 @@ impl RccInfo {
|
|||||||
// Use .get_mut instead of []-operator so that we control how bounds checks happen.
|
// 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
|
// Otherwise, core::fmt will be pulled in here in order to format the integer in the
|
||||||
// out-of-bounds error.
|
// 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;
|
*refcount -= 1;
|
||||||
if *refcount > 0 {
|
if *refcount > 0 {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user