Skip to content

Commit eac3c43

Browse files
author
bors-servo
authored
Auto merge of #165 - llogiq:clippy, r=Ms2ger
fixed some clippy warnings Just some doc fixes and needless `.clone()`s removed. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/euclid/165) <!-- Reviewable:end -->
2 parents 2e30b5c + 052c5c7 commit eac3c43

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//! the generic Unit parameter.
2020
//!
2121
//! This unit system is not mandatory and all Typed* structures have an alias
22-
//! with the default unit: UnknownUnit.
22+
//! with the default unit: `UnknownUnit`.
2323
//! for example ```Point2D<T>``` is equivalent to ```TypedPoint2D<T, UnknownUnit>```.
2424
//! Client code typically creates a set of aliases for each type and doesn't need
2525
//! to deal with the specifics of typed units further. For example:

src/point.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ define_matrix! {
2929

3030
/// Default 2d point type with no unit.
3131
///
32-
/// Point2D provides the same methods as TypedPoint2D.
32+
/// `Point2D` provides the same methods as `TypedPoint2D`.
3333
pub type Point2D<T> = TypedPoint2D<T, UnknownUnit>;
3434

3535
impl<T: Copy + Zero, U> TypedPoint2D<T, U> {
@@ -273,7 +273,7 @@ define_matrix! {
273273

274274
/// Default 3d point type with no unit.
275275
///
276-
/// Point3D provides the same methods as TypedPoint3D.
276+
/// `Point3D` provides the same methods as `TypedPoint3D`.
277277
pub type Point3D<T> = TypedPoint3D<T, UnknownUnit>;
278278

279279
impl<T: Copy + Zero, U> TypedPoint3D<T, U> {
@@ -488,7 +488,7 @@ define_matrix! {
488488

489489
/// Default 4d point with no unit.
490490
///
491-
/// Point4D provides the same methods as TypedPoint4D.
491+
/// `Point4D` provides the same methods as `TypedPoint4D`.
492492
pub type Point4D<T> = TypedPoint4D<T, UnknownUnit>;
493493

494494
impl<T: Copy + Zero, U> TypedPoint4D<T, U> {

src/rect.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ where T: Copy + Clone + Zero + PartialOrd + PartialEq + Add<T, Output=T> + Sub<T
151151
let lower_right_x = min(self.max_x(), other.max_x());
152152
let lower_right_y = min(self.max_y(), other.max_y());
153153

154-
Some(TypedRect::new(upper_left.clone(), TypedSize2D::new(lower_right_x - upper_left.x,
155-
lower_right_y - upper_left.y)))
154+
Some(TypedRect::new(upper_left, TypedSize2D::new(lower_right_x - upper_left.x,
155+
lower_right_y - upper_left.y)))
156156
}
157157

158158
/// Translates the rect by a vector.
@@ -203,7 +203,7 @@ where T: Copy + Clone + Zero + PartialOrd + PartialEq + Add<T, Output=T> + Sub<T
203203

204204
#[inline]
205205
pub fn bottom_left(&self) -> TypedPoint2D<T, U> {
206-
TypedPoint2D::new(self.origin.x.clone(), self.max_y())
206+
TypedPoint2D::new(self.origin.x, self.max_y())
207207
}
208208

209209
#[inline]
@@ -222,10 +222,10 @@ where T: Copy + Clone + PartialOrd + Add<T, Output=T> + Sub<T, Output=T> + Zero
222222
#[inline]
223223
pub fn union(&self, other: &TypedRect<T, U>) -> TypedRect<T, U> {
224224
if self.size == Zero::zero() {
225-
return other.clone();
225+
return *other;
226226
}
227227
if other.size == Zero::zero() {
228-
return self.clone();
228+
return *self;
229229
}
230230

231231
let upper_left = TypedPoint2D::new(min(self.min_x(), other.min_x()),
@@ -296,15 +296,15 @@ impl<T: Copy + Mul<T, Output=T>, U1, U2> Mul<ScaleFactor<T, U1, U2>> for TypedRe
296296
type Output = TypedRect<T, U2>;
297297
#[inline]
298298
fn mul(self, scale: ScaleFactor<T, U1, U2>) -> TypedRect<T, U2> {
299-
TypedRect::new(self.origin * scale.clone(), self.size * scale.clone())
299+
TypedRect::new(self.origin * scale, self.size * scale)
300300
}
301301
}
302302

303303
impl<T: Copy + Div<T, Output=T>, U1, U2> Div<ScaleFactor<T, U1, U2>> for TypedRect<T, U2> {
304304
type Output = TypedRect<T, U1>;
305305
#[inline]
306306
fn div(self, scale: ScaleFactor<T, U1, U2>) -> TypedRect<T, U1> {
307-
TypedRect::new(self.origin / scale.clone(), self.size / scale.clone())
307+
TypedRect::new(self.origin / scale, self.size / scale)
308308
}
309309
}
310310

src/size.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ define_matrix! {
2828

2929
/// Default 2d size type with no unit.
3030
///
31-
/// Size2D provides the same methods as TypedSize2D.
31+
/// `Size2D` provides the same methods as `TypedSize2D`.
3232
pub type Size2D<T> = TypedSize2D<T, UnknownUnit>;
3333

3434
impl<T: fmt::Debug, U> fmt::Debug for TypedSize2D<T, U> {
@@ -172,7 +172,7 @@ impl<T: NumCast + Copy, Unit> TypedSize2D<T, Unit> {
172172
/// as one would expect from a simple cast, but this behavior does not always marke sense
173173
/// geometrically. Consider using round(), ceil or floor() before casting.
174174
pub fn cast<NewT: NumCast + Copy>(&self) -> Option<TypedSize2D<NewT, Unit>> {
175-
match (NumCast::from(self.width.clone()), NumCast::from(self.height.clone())) {
175+
match (NumCast::from(self.width), NumCast::from(self.height)) {
176176
(Some(w), Some(h)) => Some(TypedSize2D::new(w, h)),
177177
_ => None
178178
}

0 commit comments

Comments
 (0)