Skip to content

Commit

Permalink
Remove unneeded extern crate and replace approx with cgmath
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi Lauzier authored and kvark committed Aug 11, 2021
1 parent ac6bb4b commit a94275e
Show file tree
Hide file tree
Showing 29 changed files with 23 additions and 61 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### v0.20
- No actual API change, but updated to Rust2018 and synced with cgmath 0.17
- Uses latest versions of rand and approx for compatibility with other libraries
- Uses the latest versions of rand and approx for compatibility with other libraries

### v0.19
- Updated version of num library to 0.2
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ name = "collision"

[dependencies]
rand = "0.8.4"
approx = "0.4" # Only for the macros; for all other instances use the re-exported cgmath ones.
cgmath = "0.18.0"
serde = { version = "1.0.126", optional = true, features = ["derive"] }
bit-set = "0.5.2"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ at your option.

## Contributing

Use [CONTRIBUTING.md](https://github.com/rustgd/collision-rs/blob/master/CONTRIBUTING.md) for futher information.
Use [CONTRIBUTING.md](https://github.com/rustgd/collision-rs/blob/master/CONTRIBUTING.md) for further information.

Pull requests are most welcome, especially in the realm of performance
enhancements and fixing any mistakes. Unit tests and benchmarks are also
Expand Down
3 changes: 0 additions & 3 deletions benches/dbvt.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#![feature(test)]

extern crate cgmath;
extern crate collision;
extern crate rand;
extern crate test;

use cgmath::prelude::*;
Expand Down
4 changes: 0 additions & 4 deletions benches/polyhedron.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#![feature(test)]

extern crate cgmath;
extern crate collision;
extern crate genmesh;
extern crate rand;
extern crate test;

use cgmath::prelude::*;
Expand Down
4 changes: 2 additions & 2 deletions src/algorithm/minkowski/epa/epa2d.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::marker;

use approx::assert_ulps_ne;
use cgmath::assert_ulps_ne;
use cgmath::num_traits::NumCast;
use cgmath::prelude::*;
use cgmath::{BaseFloat, Point2, Vector2};
Expand Down Expand Up @@ -157,7 +157,7 @@ where

#[cfg(test)]
mod tests {
use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{Basis2, Decomposed, Point2, Rad, Rotation2, Vector2};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion src/algorithm/minkowski/epa/epa3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ fn remove_or_add_edge(edges: &mut Vec<(usize, usize)>, edge: (usize, usize)) {

#[cfg(test)]
mod tests {
use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{Decomposed, Quaternion, Rad, Vector3};

use super::*;
Expand Down
4 changes: 2 additions & 2 deletions src/algorithm/minkowski/gjk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use self::simplex::{Simplex, SimplexProcessor2, SimplexProcessor3};
use crate::algorithm::minkowski::{SupportPoint, EPA, EPA2, EPA3};
use crate::prelude::*;
use crate::{CollisionStrategy, Contact};
use approx::ulps_eq;
use cgmath::ulps_eq;

mod simplex;

Expand Down Expand Up @@ -590,7 +590,7 @@ where

#[cfg(test)]
mod tests {
use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{
Basis2, Decomposed, Point2, Point3, Quaternion, Rad, Rotation2, Rotation3, Vector2, Vector3,
};
Expand Down
4 changes: 2 additions & 2 deletions src/algorithm/minkowski/gjk/simplex/simplex2d.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::marker;
use std::ops::Neg;

use approx::ulps_eq;
use cgmath::prelude::*;
use cgmath::ulps_eq;
use cgmath::{BaseFloat, Point2, Vector2};

use super::{Simplex, SimplexProcessor};
Expand Down Expand Up @@ -101,7 +101,7 @@ mod tests {

use super::*;
use crate::algorithm::minkowski::SupportPoint;
use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use smallvec::smallvec;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/algorithm/minkowski/gjk/simplex/simplex3d.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::marker;
use std::ops::Neg;

use approx::ulps_eq;
use cgmath::num_traits::cast;
use cgmath::prelude::*;
use cgmath::ulps_eq;
use cgmath::{BaseFloat, Point3, Vector3};

use super::{Simplex, SimplexProcessor};
Expand Down Expand Up @@ -223,7 +223,7 @@ fn check_side<S>(
mod tests {
use std::ops::Neg;

use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{Point3, Vector3};
use smallvec::smallvec;

Expand Down
2 changes: 1 addition & 1 deletion src/plane.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fmt;

use approx::{ulps_eq, ulps_ne};
use cgmath::prelude::*;
use cgmath::{ulps_eq, ulps_ne};
use cgmath::{AbsDiffEq, RelativeEq, UlpsEq};
use cgmath::{BaseFloat, Point3, Vector3, Vector4};

Expand Down
2 changes: 1 addition & 1 deletion src/primitive/capsule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ where
mod tests {
use std;

use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{Decomposed, Quaternion, Rad, Vector3};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion src/primitive/circle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ mod tests {

use crate::prelude::*;
use crate::Ray2;
use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{Basis2, Decomposed, Point2, Rad, Rotation2, Vector2};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion src/primitive/cuboid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ where
#[cfg(test)]
mod tests {

use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{Decomposed, Point3, Quaternion, Rad, Vector3};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion src/primitive/cylinder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ where
mod tests {
use std;

use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{Decomposed, Quaternion, Rad, Vector3};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion src/primitive/particle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ where

#[cfg(test)]
mod tests {
use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::prelude::*;
use cgmath::{Basis2, Decomposed, Point2, Rad, Vector2};

Expand Down
2 changes: 1 addition & 1 deletion src/primitive/polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ where

#[cfg(test)]
mod tests {
use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{Basis2, Decomposed, Point2, Rad, Vector2};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion src/primitive/polyhedron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ where
#[cfg(test)]
mod tests {

use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::prelude::*;
use cgmath::{Decomposed, Point3, Quaternion, Rad, Vector3};

Expand Down
2 changes: 1 addition & 1 deletion src/primitive/rectangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ where

#[cfg(test)]
mod tests {
use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{Basis2, Decomposed, Point2, Rad, Vector2};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion src/primitive/sphere.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ where
mod tests {
use std;

use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{Decomposed, Point3, Quaternion, Rad, Rotation3, Vector3};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion src/primitive/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ where
mod tests {
use std;

use approx::assert_ulps_eq;
use cgmath::assert_ulps_eq;
use cgmath::{Basis2, Decomposed, Point2, Rad, Rotation2, Vector2};

use super::*;
Expand Down
3 changes: 0 additions & 3 deletions tests/aabb.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
extern crate cgmath;
extern crate collision;

use cgmath::InnerSpace;
use cgmath::{Point2, Point3};
use cgmath::{Vector2, Vector3};
Expand Down
2 changes: 0 additions & 2 deletions tests/bound.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate collision;

use collision::PlaneBound;

fn _box(_: Box<dyn PlaneBound<f32>>) {}
Expand Down
4 changes: 0 additions & 4 deletions tests/dbvt.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
extern crate cgmath;
extern crate collision;
extern crate rand;

use cgmath::prelude::*;
use cgmath::{Deg, PerspectiveFov, Point2, Point3, Vector2, Vector3};
use collision::dbvt::*;
Expand Down
3 changes: 0 additions & 3 deletions tests/frustum.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
extern crate cgmath;
extern crate collision;

use cgmath::{PerspectiveFov, Point3, Rad};
use collision::{Projection, Relation, Sphere};

Expand Down
5 changes: 0 additions & 5 deletions tests/plane.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
extern crate approx;

extern crate cgmath;
extern crate collision;

use cgmath::*;
use collision::*;

Expand Down
7 changes: 1 addition & 6 deletions tests/point.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#[macro_use]
extern crate approx;

extern crate cgmath;
extern crate collision;

use cgmath::assert_ulps_eq;
use cgmath::{Point3, Vector3};
use collision::{Continuous, Plane, PlaneBound, Ray3, Relation};

Expand Down
3 changes: 0 additions & 3 deletions tests/serde.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#![cfg(feature = "serde")]

extern crate cgmath;
extern crate serde;

use cgmath::Point1;
use serde::Serialize;

Expand Down
5 changes: 0 additions & 5 deletions tests/sphere.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
extern crate approx;

extern crate cgmath;
extern crate collision;

use cgmath::*;
use collision::*;

Expand Down

0 comments on commit a94275e

Please sign in to comment.