diff options
| author | David Flemström <[email protected]> | 2024-06-29 01:34:07 +0200 |
|---|---|---|
| committer | David Flemström <[email protected]> | 2024-06-29 01:34:07 +0200 |
| commit | 114dda2fd1afb37d2b563b9ac5018830ad7b6d4f (patch) | |
| tree | 68cbc0c03bb4214222c0f56b3362578318d29261 | |
| parent | 2f750a82bf15327958bd0a31f05714f3528edcc4 (diff) | |
Avoid accidental copy of static var before creating mut ref
| -rw-r--r-- | embassy-stm32/src/rcc/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs index c29d31fd9..360df93ae 100644 --- a/embassy-stm32/src/rcc/mod.rs +++ b/embassy-stm32/src/rcc/mod.rs | |||
| @@ -142,7 +142,7 @@ impl RccInfo { | |||
| 142 | // Use .get_mut instead of []-operator so that we control how bounds checks happen. | 142 | // Use .get_mut instead of []-operator so that we control how bounds checks happen. |
| 143 | // Otherwise, core::fmt will be pulled in here in order to format the integer in the | 143 | // Otherwise, core::fmt will be pulled in here in order to format the integer in the |
| 144 | // out-of-bounds error. | 144 | // out-of-bounds error. |
| 145 | if let Some(refcount) = unsafe { crate::_generated::REFCOUNTS }.get_mut(refcount_idx) { | 145 | if let Some(refcount) = unsafe { crate::_generated::REFCOUNTS.get_mut(refcount_idx) } { |
| 146 | *refcount += 1; | 146 | *refcount += 1; |
| 147 | if *refcount > 1 { | 147 | if *refcount > 1 { |
| 148 | return; | 148 | return; |
| @@ -206,7 +206,7 @@ impl RccInfo { | |||
| 206 | // Use .get_mut instead of []-operator so that we control how bounds checks happen. | 206 | // Use .get_mut instead of []-operator so that we control how bounds checks happen. |
| 207 | // Otherwise, core::fmt will be pulled in here in order to format the integer in the | 207 | // Otherwise, core::fmt will be pulled in here in order to format the integer in the |
| 208 | // out-of-bounds error. | 208 | // out-of-bounds error. |
| 209 | if let Some(refcount) = unsafe { crate::_generated::REFCOUNTS }.get_mut(refcount_idx) { | 209 | if let Some(refcount) = unsafe { crate::_generated::REFCOUNTS.get_mut(refcount_idx) } { |
| 210 | *refcount -= 1; | 210 | *refcount -= 1; |
| 211 | if *refcount > 0 { | 211 | if *refcount > 0 { |
| 212 | return; | 212 | return; |
