Skip to content

Commit 3a78604

Browse files
committed
Upstream some utility functions
1 parent dc9658d commit 3a78604

File tree

3 files changed

+4
-18
lines changed

3 files changed

+4
-18
lines changed

backend/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/src/classify.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ mod tests {
104104
(vec!["highway=path", "footway=sidewalk"], Kind::Other),
105105
(vec!["highway=cycleway", "foot=yes"], Kind::Other),
106106
] {
107-
let actual = Kind::classify(&tags(&input));
107+
let actual = Kind::classify(&Tags::new_from_pairs(&input));
108108
if actual != expected {
109109
println!("For {input:?}, expected {expected:?} but got {actual:?}\n");
110110
ok = false;
@@ -115,14 +115,4 @@ mod tests {
115115
panic!("Some cases failed");
116116
}
117117
}
118-
119-
// TODO Upstream as a test utility
120-
fn tags(input: &Vec<&'static str>) -> Tags {
121-
let mut tags = Tags::empty();
122-
for kv in input {
123-
let parts = kv.split("=").collect::<Vec<_>>();
124-
tags.insert(parts[0], parts[1]);
125-
}
126-
tags
127-
}
128118
}

backend/src/disconnected.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl Speedwalk {
7979
FeatureCollection {
8080
features,
8181
bbox: None,
82-
foreign_members: Some(into_object_value(serde_json::json!({
82+
foreign_members: Some(utils::into_object_value(serde_json::json!({
8383
"component_lengths": component_lengths,
8484
"component_bboxes": component_bboxes,
8585
}))),
@@ -97,8 +97,3 @@ fn nodes_to_ways(graph: &Graph, nodes: Vec<IntersectionID>) -> BTreeSet<WayID> {
9797
}
9898
ways
9999
}
100-
101-
// TODO Upstream
102-
fn into_object_value(value: serde_json::Value) -> serde_json::Map<String, serde_json::Value> {
103-
value.as_object().unwrap().clone()
104-
}

0 commit comments

Comments
 (0)