diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f1030da18..9fef1e451 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: name: ci result runs-on: ubuntu-latest needs: - - clippy + - lint - geo_types - geo - geo_postgis @@ -35,21 +35,22 @@ jobs: if: "!success()" run: exit 1 - clippy: - name: clippy + lint: + name: lint runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, '[skip ci]')" strategy: matrix: container_image: - # Use the latest stable clippy. No need for older versions. - - "georust/geo-ci:rust-1.58" + # Use the latest stable version. No need for older versions. + - "georust/geo-ci:rust-1.59" container: image: ${{ matrix.container_image }} steps: - name: Checkout repository uses: actions/checkout@v2 - - run: rustup component add clippy + - run: rustup component add rustfmt clippy + - run: cargo fmt --all -- --check - run: cargo clippy --all-features --all-targets -- -Dwarnings geo_types: @@ -68,8 +69,8 @@ jobs: # Minimum supported rust version (MSRV) - "georust/geo-ci:rust-1.56" # Two most recent releases - we omit older ones for expedient CI - - "georust/geo-ci:rust-1.57" - "georust/geo-ci:rust-1.58" + - "georust/geo-ci:rust-1.59" container: image: ${{ matrix.container_image }} steps: @@ -94,8 +95,8 @@ jobs: # Minimum supported rust version (MSRV) - "georust/geo-ci:rust-1.56" # Two most recent releases - we omit older ones for expedient CI - - "georust/geo-ci:rust-1.57" - "georust/geo-ci:rust-1.58" + - "georust/geo-ci:rust-1.59" container: image: ${{ matrix.container_image }} steps: @@ -121,8 +122,8 @@ jobs: # Minimum supported rust version (MSRV) - "georust/geo-ci:rust-1.56" # Two most recent releases - we omit older ones for expedient CI - - "georust/geo-ci:rust-1.57" - "georust/geo-ci:rust-1.58" + - "georust/geo-ci:rust-1.59" container: image: ${{ matrix.container_image }} steps: @@ -142,7 +143,7 @@ jobs: matrix: container_image: # Fuzz only on latest - - "georust/geo-ci:rust-1.57" + - "georust/geo-ci:rust-1.59" container: image: ${{ matrix.container_image }} steps: diff --git a/geo-types/CHANGES.md b/geo-types/CHANGES.md index 1af7adac5..064eb9f73 100644 --- a/geo-types/CHANGES.md +++ b/geo-types/CHANGES.md @@ -4,7 +4,8 @@ * Note: All crates have been migrated to Rust 2021 edition. The MSRV when installing the latest dependencies has increased to 1.56. * -* +* Macros `coord!`, `point!`, `line_string!`, and `polygon!` now support trailing commas such as `coord! { x: 181.2, y: 51.79, }` + * ## 0.7.3 diff --git a/geo-types/src/macros.rs b/geo-types/src/macros.rs index a2b6b95c1..dea9d555b 100644 --- a/geo-types/src/macros.rs +++ b/geo-types/src/macros.rs @@ -22,7 +22,7 @@ /// [`Point`]: ./struct.Point.html #[macro_export] macro_rules! point { - (x: $x:expr, y: $y:expr) => { + (x: $x:expr, y: $y:expr $(,)?) => { $crate::Point::new($x, $y) }; } @@ -48,7 +48,7 @@ macro_rules! point { /// [`Coordinate`]: ./struct.Point.html #[macro_export] macro_rules! coord { - (x: $x:expr, y: $y:expr) => { + (x: $x:expr, y: $y:expr $(,)?) => { $crate::Coordinate { x: $x, y: $y } }; } @@ -70,7 +70,7 @@ macro_rules! coord { /// (x: -21.95156, y: 64.1446), /// (x: -21.951, y: 64.14479), /// (x: -21.95044, y: 64.14527), -/// (x: -21.951445, y: 64.145508) +/// (x: -21.951445, y: 64.145508), /// ]; /// /// assert_eq!(ls[1], geo_types::Coordinate { @@ -118,7 +118,7 @@ macro_rules! coord { macro_rules! line_string { () => { $crate::LineString(vec![]) }; ( - $((x: $x:expr, y: $y:expr)),* + $((x: $x:expr, y: $y:expr $(,)?)),* $(,)? ) => { line_string![ @@ -212,12 +212,12 @@ macro_rules! polygon { () => { $crate::Polygon::new(line_string![], vec![]) }; ( exterior: [ - $((x: $exterior_x:expr, y: $exterior_y:expr)),* + $((x: $exterior_x:expr, y: $exterior_y:expr $(,)?)),* $(,)? ], interiors: [ $([ - $((x: $interior_x:expr, y: $interior_y:expr)),* + $((x: $interior_x:expr, y: $interior_y:expr $(,)?)),* $(,)? ]),* $(,)? @@ -234,7 +234,6 @@ macro_rules! polygon { $([ $($crate::Coordinate { x: $interior_x, y: $interior_y }),* ]),* - ], ) }; @@ -268,7 +267,7 @@ macro_rules! polygon { ) }; ( - $((x: $x:expr, y: $y:expr)),* + $((x: $x:expr, y: $y:expr $(,)?)),* $(,)? ) => { polygon![