Skip to content

Commit 70651ba

Browse files
committed
Simplify CI and bump geo
1 parent ef3ab70 commit 70651ba

File tree

3 files changed

+51
-17
lines changed

3 files changed

+51
-17
lines changed

.github/workflows/test.yml

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
on: push
1+
on:
2+
push:
3+
pull_request:
4+
workflow_dispatch:
5+
26
name: Run tests
37
jobs:
48
# The `ci-result` job doesn't actually test anything - it just aggregates the
@@ -30,20 +34,45 @@ jobs:
3034
working-directory: .
3135
strategy:
3236
matrix:
33-
container_image:
37+
toolchain:
3438
# We aim to support rust-stable plus (at least) the prior 3 releases,
3539
# giving us about 6 months of coverage.
3640
#
3741
# Minimum supported rust version (MSRV)
38-
- "georust/geo-ci:rust-1.67"
39-
# Two most recent releases - we omit older ones for expedient CI
40-
- "georust/geo-ci:rust-1.69"
41-
- "georust/geo-ci:rust-1.70"
42-
container:
43-
image: ${{ matrix.container_image }}
42+
- "1.67"
43+
# Two recent releases - we omit older ones for expedient CI
44+
- "1.80"
45+
- "stable"
4446
steps:
4547
- name: Checkout repository
46-
uses: actions/checkout@v3
48+
uses: actions/checkout@v4
49+
50+
- name: Install stable
51+
run: |
52+
rustup toolchain install ${{ matrix.toolchain }} --no-self-update --profile minimal --component rust-src clippy
53+
rustup component add rustfmt clippy
54+
55+
- name: Check with Rustfmt
56+
run: cargo fmt --all --check
57+
58+
- name: Build (--no-default-features)
59+
run: cargo build --no-default-features
60+
- name: Build (--all-features)
61+
run: cargo build --all-features
62+
- name: Run tests (--all-features)
63+
run: cargo test --all-features
64+
- name: Build
65+
run: cargo build
66+
- name: Run tests
67+
run: cargo test
68+
69+
- name: Check with Clippy (--no-default-features)
70+
run: cargo clippy --tests --no-default-features -- -D warnings
71+
- name: Check with Clippy (--all-features)
72+
run: cargo clippy --tests --all-features -- -D warnings
73+
- name: Check with Clippy
74+
run: cargo clippy --tests -- -D warnings
75+
4776
- run: cargo build --no-default-features
4877
- run: cargo test --no-default-features
4978
- run: cargo build --all-features

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ serde = { version = "1.0", features = ["derive"], optional = true }
2424

2525
[dev-dependencies]
2626
assert_approx_eq = "1"
27-
geo = "0.27"
27+
geo = "0.28"

src/writer.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,11 @@ fn write_fix_if_exists<W: Write>(fix: &Option<Fix>, writer: &mut EventWriter<W>)
293293
Ok(())
294294
}
295295

296-
fn write_track<W: Write>(version: GpxVersion, track: &Track, writer: &mut EventWriter<W>) -> GpxResult<()> {
296+
fn write_track<W: Write>(
297+
version: GpxVersion,
298+
track: &Track,
299+
writer: &mut EventWriter<W>,
300+
) -> GpxResult<()> {
297301
write_xml_event(XmlEvent::start_element("trk"), writer)?;
298302
write_string_if_exists("name", &track.name, writer)?;
299303
write_string_if_exists("cmt", &track.comment, writer)?;
@@ -310,7 +314,11 @@ fn write_track<W: Write>(version: GpxVersion, track: &Track, writer: &mut EventW
310314
Ok(())
311315
}
312316

313-
fn write_route<W: Write>(version: GpxVersion, route: &Route, writer: &mut EventWriter<W>) -> GpxResult<()> {
317+
fn write_route<W: Write>(
318+
version: GpxVersion,
319+
route: &Route,
320+
writer: &mut EventWriter<W>,
321+
) -> GpxResult<()> {
314322
write_xml_event(XmlEvent::start_element("rte"), writer)?;
315323
write_string_if_exists("name", &route.name, writer)?;
316324
write_string_if_exists("cmt", &route.comment, writer)?;
@@ -354,11 +362,8 @@ fn write_waypoint<W: Write>(
354362
writer,
355363
)?;
356364
write_value_if_exists("ele", &waypoint.elevation, writer)?;
357-
match version {
358-
GpxVersion::Gpx10 => {
359-
write_value_if_exists("speed", &waypoint.speed, writer)?;
360-
}
361-
_ => {}
365+
if version == GpxVersion::Gpx10 {
366+
write_value_if_exists("speed", &waypoint.speed, writer)?;
362367
}
363368
write_time_if_exists(&waypoint.time, writer)?;
364369
write_value_if_exists("geoidheight", &waypoint.geoidheight, writer)?;

0 commit comments

Comments
 (0)