Skip to content

Commit 52a92c9

Browse files
committed
Fix clippy lints
1 parent 0473da0 commit 52a92c9

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

src/data_processing.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ pub struct GenerationOptions {
2828
pub spawn_point: Option<(i32, i32)>,
2929
}
3030

31-
const SMALLEST_AREA_TAGS: &[&str] = &["landuse", "leisure", "natural"];
31+
static SMALLEST_AREA_TAGS: once_cell::sync::Lazy<Vec<String>> = once_cell::sync::Lazy::new(|| {
32+
vec![
33+
"landuse".to_string(),
34+
"leisure".to_string(),
35+
"natural".to_string(),
36+
]
37+
});
3238

3339
fn accumulate_smallest_area(
3440
editor: &mut WorldEditor,
@@ -37,7 +43,7 @@ fn accumulate_smallest_area(
3743
flood_fill_cache: &FloodFillCache,
3844
args: &Args,
3945
) {
40-
let Some(tag_value) = way.tags.get(&tag_key.to_string()) else {
46+
let Some(tag_value) = way.tags.get(tag_key) else {
4147
return;
4248
};
4349

@@ -58,7 +64,7 @@ fn accumulate_smallest_area_from_relation(
5864
flood_fill_cache: &FloodFillCache,
5965
args: &Args,
6066
) {
61-
if !rel.tags.contains_key(&tag_key.to_string()) {
67+
if !rel.tags.contains_key(tag_key) {
6268
return;
6369
}
6470

@@ -188,8 +194,8 @@ pub fn generate_world_with_options(
188194
for element in &elements {
189195
match element {
190196
ProcessedElement::Way(way) => {
191-
for tag_key in SMALLEST_AREA_TAGS {
192-
if way.tags.contains_key(&tag_key.to_string()) {
197+
for tag_key in SMALLEST_AREA_TAGS.iter() {
198+
if way.tags.contains_key(tag_key) {
193199
accumulate_smallest_area(
194200
&mut editor,
195201
way,
@@ -201,8 +207,8 @@ pub fn generate_world_with_options(
201207
}
202208
}
203209
ProcessedElement::Relation(rel) => {
204-
for tag_key in SMALLEST_AREA_TAGS {
205-
if rel.tags.contains_key(&tag_key.to_string()) {
210+
for tag_key in SMALLEST_AREA_TAGS.iter() {
211+
if rel.tags.contains_key(tag_key) {
206212
accumulate_smallest_area_from_relation(
207213
&mut editor,
208214
rel,

0 commit comments

Comments
 (0)