From a02b94fb70ebc5872e25e9ccbc68913809bd5114 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Sun, 13 Dec 2015 12:20:07 +1100 Subject: [PATCH 1/2] Remove 'static constraints These seem to be relics from an older Rust... --- src/num.rs | 1 - src/projection.rs | 8 ++++---- src/quaternion.rs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/num.rs b/src/num.rs index 9811d17..f6e74d0 100644 --- a/src/num.rs +++ b/src/num.rs @@ -63,7 +63,6 @@ partial_ord_float!(f64); pub trait BaseNum: Copy + NumCast + Clone + Num + PartialOrd + cmp::PartialOrd + fmt::Debug - + 'static {} diff --git a/src/projection.rs b/src/projection.rs index d65f4a1..da16e23 100644 --- a/src/projection.rs +++ b/src/projection.rs @@ -24,7 +24,7 @@ use num::BaseFloat; /// /// This is the equivalent to the [gluPerspective] /// (http://www.opengl.org/sdk/docs/man2/xhtml/gluPerspective.xml) function. -pub fn perspective>(fovy: A, aspect: S, near: S, far: S) -> Matrix4 { +pub fn perspective>(fovy: A, aspect: S, near: S, far: S) -> Matrix4 { PerspectiveFov { fovy: fovy, aspect: aspect, @@ -37,7 +37,7 @@ pub fn perspective>(fovy: A, aspect: S, near /// /// This is the equivalent of the now deprecated [glFrustrum] /// (http://www.opengl.org/sdk/docs/man2/xhtml/glFrustum.xml) function. -pub fn frustum(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4 { +pub fn frustum(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4 { Perspective { left: left, right: right, @@ -52,7 +52,7 @@ pub fn frustum(left: S, right: S, bottom: S, top: S, nea /// /// This is the equivalent of the now deprecated [glOrtho] /// (http://www.opengl.org/sdk/docs/man2/xhtml/glOrtho.xml) function. -pub fn ortho(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4 { +pub fn ortho(left: S, right: S, bottom: S, top: S, near: S, far: S) -> Matrix4 { Ortho { left: left, right: right, @@ -143,7 +143,7 @@ pub struct Perspective { pub far: S, } -impl From> for Matrix4 { +impl From> for Matrix4 { fn from(persp: Perspective) -> Matrix4 { assert!(persp.left <= persp.right, "`left` cannot be greater than `right`, found: left: {:?} right: {:?}", persp.left, persp.right); assert!(persp.bottom <= persp.top, "`bottom` cannot be greater than `top`, found: bottom: {:?} top: {:?}", persp.bottom, persp.top); diff --git a/src/quaternion.rs b/src/quaternion.rs index 1f9abdc..571d848 100644 --- a/src/quaternion.rs +++ b/src/quaternion.rs @@ -359,7 +359,7 @@ impl Rotation> for Quaternion { fn invert_self(&mut self) { *self = self.invert() } } -impl Rotation3 for Quaternion where S: 'static { +impl Rotation3 for Quaternion { #[inline] fn from_axis_angle(axis: Vector3, angle: Rad) -> Quaternion { let (s, c) = sin_cos(angle.mul_s(cast(0.5f64).unwrap())); From 46124ddcc50d6abbd9475831e133044f4be43157 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Sun, 13 Dec 2015 12:27:20 +1100 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a29da0..ea63e45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - Add missing by-ref and by-val permutations of `Quaternion` operators. +- Ease lifetime constraints by removing `'static` from some scalar type + parameters. ### Removed - Remove redundant `Point::{min, max}` methods - these are now covered by the