Merge branch 'Resolve-all-'#-allow(clippy--needless_range_loop)]'-error-supressions' into 'master'

Resolve all '#[allow(clippy::needless_range_loop)]' error supressions

See merge request veloren/veloren!3042
This commit is contained in:
Joshua Barretto
2021-12-03 16:03:54 +00:00
2 changed files with 4 additions and 6 deletions

View File

@ -301,7 +301,6 @@ impl RegionMap {
} }
/// Add a region using its key /// Add a region using its key
#[allow(clippy::needless_range_loop)] // TODO: Pending review in #587
fn remove_index(&mut self, index: usize) { fn remove_index(&mut self, index: usize) {
// Remap neighbor indices for neighbors of the region that will be moved from // Remap neighbor indices for neighbors of the region that will be moved from
// the end of the index map // the end of the index map
@ -312,10 +311,10 @@ impl RegionMap {
.map(|(_, v)| v) .map(|(_, v)| v)
.unwrap() .unwrap()
.neighbors; .neighbors;
for i in 0..8 { for (i, possible_idx) in moved_neighbors.iter().enumerate() {
if let Some(idx) = moved_neighbors[i] { if let Some(idx) = possible_idx {
self.regions self.regions
.get_index_mut(idx) .get_index_mut(*idx)
.map(|(_, v)| v) .map(|(_, v)| v)
.unwrap() .unwrap()
.neighbors[(i + 4) % 8] = Some(index); .neighbors[(i + 4) % 8] = Some(index);

View File

@ -115,7 +115,6 @@ impl<'a, T> Widget for RadioList<'a, T> {
fn style(&self) -> Self::Style {} fn style(&self) -> Self::Style {}
#[allow(clippy::needless_range_loop)] // TODO: Pending review in #587
fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event { fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event {
let widget::UpdateArgs { let widget::UpdateArgs {
id, id,
@ -165,7 +164,7 @@ impl<'a, T> Widget for RadioList<'a, T> {
.unwrap_or(selected); .unwrap_or(selected);
let (x, y, w, h) = rect.x_y_w_h(); let (x, y, w, h) = rect.x_y_w_h();
for i in 0..num_items { for (i, _j) in options_labels.iter().enumerate().take(num_items) {
let image = if i == current_selection { let image = if i == current_selection {
t_image t_image
} else { } else {