Skip to content

Commit

Permalink
fixup nostd build of geo-types macros
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkirk committed Sep 20, 2023
1 parent 19db287 commit fb3d0f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
2 changes: 0 additions & 2 deletions geo-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ pub mod _alloc {
//! Needed to access these types from `alloc` in macros when the std feature is
//! disabled and the calling context is missing `extern crate alloc`. These are
//! _not_ meant for public use.

pub use ::alloc::boxed::Box;
pub use ::alloc::vec;
}

Expand Down
26 changes: 10 additions & 16 deletions geo-types/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ macro_rules! coord {
/// [`LineString`]: ./line_string/struct.LineString.html
#[macro_export]
macro_rules! line_string {
() => { $crate::LineString::new(vec![]) };
() => { $crate::LineString::new($crate::_alloc::vec![]) };
(
$(( $($tag:tt : $val:expr),* $(,)? )),*
$(,)?
Expand All @@ -139,11 +139,9 @@ macro_rules! line_string {
$(,)?
) => {
$crate::LineString::new(
<[_]>::into_vec(
$crate::_alloc::Box::new(
[$($coord), *]
)
)
$crate::_alloc::vec![
$($coord),*
]
)
};
}
Expand Down Expand Up @@ -216,7 +214,7 @@ macro_rules! line_string {
/// [`Polygon`]: ./struct.Polygon.html
#[macro_export]
macro_rules! polygon {
() => { $crate::Polygon::new($crate::line_string![], vec![]) };
() => { $crate::Polygon::new($crate::line_string![], $crate::_alloc::vec![]) };
(
exterior: [
$(( $($exterior_tag:tt : $exterior_val:expr),* $(,)? )),*
Expand Down Expand Up @@ -262,15 +260,11 @@ macro_rules! polygon {
$crate::line_string![
$($exterior_coord), *
],
<[_]>::into_vec(
$crate::_alloc::Box::new(
[
$(
$crate::line_string![$($interior_coord),*]
), *
]
)
)
$crate::_alloc::vec![
$(
$crate::line_string![$($interior_coord),*]
), *
]
)
};
(
Expand Down
1 change: 1 addition & 0 deletions geo-types/src/wkt_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ macro_rules! wkt_internal {
#[cfg(test)]
mod test {
use crate::geometry::*;
use alloc::vec;

#[test]
fn point() {
Expand Down

0 comments on commit fb3d0f8

Please sign in to comment.