Skip to content

Commit 5b3bc86

Browse files
authored
Rust 1 95 (#126)
* Performance monitor fixes * Rust 1.95
1 parent 4bc6cbb commit 5b3bc86

54 files changed

Lines changed: 37 additions & 48 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.94.0"
2+
channel = "1.95.0"
33
profile = "minimal"

src/bin/mapcat/sender.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl MapSender {
145145
return false;
146146
}
147147

148-
while let Err(e) = surf::get(format!("http://localhost:{DEFAULT_PORT}/healthcheck",))
148+
while let Err(e) = surf::get(format!("http://localhost:{DEFAULT_PORT}/healthcheck"))
149149
.send()
150150
.await
151151
{

src/map/mapvas_egui/layer/shape_layer.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ impl ShapeLayer {
382382
received = true;
383383
let l = self.shape_map.entry(id.clone()).or_default();
384384
let start_idx = l.len();
385-
l.extend(geometries.into_iter());
385+
l.extend(geometries);
386386
self.layer_visibility.entry(id.clone()).or_insert(true);
387387

388388
for i in start_idx..l.len() {
@@ -2675,14 +2675,12 @@ impl ShapeLayer {
26752675

26762676
for &path_index in nested_path {
26772677
match current_geometry {
2678-
Geometry::GeometryCollection(nested_geometries, _) => {
2679-
if path_index < nested_geometries.len() {
2680-
current_geometry = &nested_geometries[path_index];
2681-
} else {
2682-
return None; // Invalid path index
2683-
}
2678+
Geometry::GeometryCollection(nested_geometries, _)
2679+
if path_index < nested_geometries.len() =>
2680+
{
2681+
current_geometry = &nested_geometries[path_index];
26842682
}
2685-
_ => return None, // Path continues but current geometry is not a collection
2683+
_ => return None,
26862684
}
26872685
}
26882686

src/map/mapvas_egui/layer/tile_layer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ impl TileLayer {
419419
});
420420

421421
let render_result =
422-
tokio::time::timeout(std::time::Duration::from_secs(60), render_rx).await;
422+
tokio::time::timeout(std::time::Duration::from_mins(1), render_rx).await;
423423

424424
let render_duration = render_start.elapsed();
425425

src/mapvas_ui.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ impl Sidebar {
802802
for category in category_order {
803803
if let Some(mut tasks) = tasks_by_category.remove(&category) {
804804
// Sort by elapsed time (newest first)
805-
tasks.sort_by_key(|(_, task)| std::cmp::Reverse(task.elapsed()));
805+
tasks.sort_by_cached_key(|(_, task)| std::cmp::Reverse(task.elapsed()));
806806

807807
let category_name = match category {
808808
TaskCategory::TileLoad => "🗺 Tile Loading",

src/parser/geojson.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -760,23 +760,21 @@ mod tests {
760760

761761
for geometry in &layer.geometries {
762762
match geometry {
763-
Geometry::Point(_, metadata) => {
763+
Geometry::Point(_, metadata)
764764
if metadata
765765
.time_data
766766
.as_ref()
767-
.is_some_and(|td| td.timestamp.is_some())
768-
{
769-
features_with_timestamps += 1;
770-
}
767+
.is_some_and(|td| td.timestamp.is_some()) =>
768+
{
769+
features_with_timestamps += 1;
771770
}
772-
Geometry::LineString(_, metadata) => {
771+
Geometry::LineString(_, metadata)
773772
if metadata
774773
.time_data
775774
.as_ref()
776-
.is_some_and(|td| td.time_span.is_some())
777-
{
778-
features_with_time_spans += 1;
779-
}
775+
.is_some_and(|td| td.time_span.is_some()) =>
776+
{
777+
features_with_time_spans += 1;
780778
}
781779
_ => {}
782780
}

src/parser/gpx.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -340,19 +340,16 @@ mod tests {
340340

341341
for geometry in &layer.geometries {
342342
match geometry {
343-
Geometry::Point(_, metadata) => {
344-
if metadata.time_data.is_some() {
345-
timestamped_points += 1;
346-
}
343+
Geometry::Point(_, metadata) if metadata.time_data.is_some() => {
344+
timestamped_points += 1;
347345
}
348-
Geometry::LineString(_, metadata) => {
346+
Geometry::LineString(_, metadata)
349347
if metadata
350348
.time_data
351349
.as_ref()
352-
.is_some_and(|td| td.time_span.is_some())
353-
{
354-
linestrings_with_timespan += 1;
355-
}
350+
.is_some_and(|td| td.time_span.is_some()) =>
351+
{
352+
linestrings_with_timespan += 1;
356353
}
357354
_ => {}
358355
}

src/remote.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub async fn remote_runner(remote: Remote) {
144144

145145
// Keep it running.
146146
loop {
147-
tokio::time::sleep(tokio::time::Duration::from_secs(3600)).await;
147+
tokio::time::sleep(tokio::time::Duration::from_hours(1)).await;
148148
}
149149
}
150150

src/search.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,7 @@ impl SearchManager {
172172
}
173173

174174
// Sort by relevance (highest first)
175-
all_results.sort_by(|a, b| {
176-
b.relevance
177-
.partial_cmp(&a.relevance)
178-
.unwrap_or(std::cmp::Ordering::Equal)
179-
});
175+
all_results.sort_by(|a, b| b.relevance.total_cmp(&a.relevance));
180176

181177
// Limit total results
182178
all_results.truncate(10);

tests/grid_snapshot_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::fs;
1111
use std::io::Cursor;
1212

1313
fn create_test_app_with_geojson_grid_mode(geojson_content: String) -> MapApp {
14-
let config = Config::new();
14+
let config = Config::default();
1515
let ctx = egui::Context::default();
1616
let (mut map, remote, data_holder) = Map::new(ctx);
1717
map.set_headless();
@@ -33,7 +33,7 @@ fn create_test_app_with_geojson_grid_mode(geojson_content: String) -> MapApp {
3333
}
3434

3535
fn create_test_app_grid_mode() -> MapApp {
36-
let config = Config::new();
36+
let config = Config::default();
3737
let ctx = egui::Context::default();
3838
let (mut map, remote, data_holder) = Map::new(ctx);
3939
map.set_headless();

0 commit comments

Comments
 (0)