Use values_mut() to iterate map values (for_kv_map)

This commit is contained in:
ice_iix 2020-07-02 17:07:48 -07:00
parent 35f29705b3
commit 9939eae361
2 changed files with 4 additions and 4 deletions

View File

@ -219,7 +219,7 @@ impl Manager {
textures: &Arc<RwLock<super::TextureManager>>, textures: &Arc<RwLock<super::TextureManager>>,
) { ) {
for collection in &mut self.collections { for collection in &mut self.collections {
for (_, model) in &mut collection.models { for model in collection.models.values_mut() {
for vert in &mut model.verts { for vert in &mut model.verts {
vert.texture = if vert.texture.version == version { vert.texture = if vert.texture.version == version {
vert.texture.clone() vert.texture.clone()

View File

@ -313,7 +313,7 @@ impl World {
pub fn copy_cloud_heightmap(&mut self, data: &mut [u8]) -> bool { pub fn copy_cloud_heightmap(&mut self, data: &mut [u8]) -> bool {
let mut dirty = false; let mut dirty = false;
for (_, c) in &mut self.chunks { for c in self.chunks.values_mut() {
if c.heightmap_dirty { if c.heightmap_dirty {
dirty = true; dirty = true;
c.heightmap_dirty = false; c.heightmap_dirty = false;
@ -440,7 +440,7 @@ impl World {
pub fn get_dirty_chunk_sections(&mut self) -> Vec<(i32, i32, i32)> { pub fn get_dirty_chunk_sections(&mut self) -> Vec<(i32, i32, i32)> {
let mut out = vec![]; let mut out = vec![];
for (_, chunk) in &mut self.chunks { for chunk in self.chunks.values_mut() {
for sec in &mut chunk.sections { for sec in &mut chunk.sections {
if let Some(sec) = sec.as_mut() { if let Some(sec) = sec.as_mut() {
if !sec.building && sec.dirty { if !sec.building && sec.dirty {
@ -487,7 +487,7 @@ impl World {
} }
pub fn flag_dirty_all(&mut self) { pub fn flag_dirty_all(&mut self) {
for (_, chunk) in &mut self.chunks { for chunk in self.chunks.values_mut() {
for sec in &mut chunk.sections { for sec in &mut chunk.sections {
if let Some(sec) = sec.as_mut() { if let Some(sec) = sec.as_mut() {
sec.dirty = true; sec.dirty = true;