Skip to content

Commit 96f3ba4

Browse files
committed
Accept some rustfmt suggestions
1 parent 7cee8b5 commit 96f3ba4

5 files changed

Lines changed: 27 additions & 17 deletions

File tree

src/point/conv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl<PD: PointData> From<&Point<PD>> for Handle {
1212

1313
impl GlifPoint {
1414
pub fn from_handle<PD: PointData>(point: &Point<PD>, wh: WhichHandle) -> Self {
15-
let (x, y) = point.handle_or_colocated(wh, &|f|f, &|f|f);
15+
let (x, y) = point.handle_or_colocated(wh, &|f| f, &|f| f);
1616
GlifPoint::from_x_y_type((x, y), PointType::OffCurve)
1717
}
1818
}

src/point/conv/kurbo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
pub use kurbo::Point as KurboPoint;
21
use crate::point::{GlifPoint, PointLike, PointType};
2+
pub use kurbo::Point as KurboPoint;
33

44
impl<'a> Into<KurboPoint> for &'a dyn PointLike {
55
fn into(self) -> KurboPoint {

src/point/conv/skia.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
use super::kurbo::{FromKurboPoint, KurboPoint, ToKurboPoint};
2+
use crate::point::{IsValid, PointLike};
13
use integer_or_float::IntegerOrFloat;
4+
use skia::Point as SkPoint;
25
use skia_safe as skia;
3-
use skia::{Point as SkPoint};
4-
use super::kurbo::{KurboPoint, FromKurboPoint, ToKurboPoint};
5-
use crate::point::{IsValid, PointLike};
66

77
pub trait ToSkiaPoint {
88
fn to_skia(&self) -> SkPoint;

src/point/valid.rs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use kurbo::Point as KurboPoint;
21
use super::*;
2+
use kurbo::Point as KurboPoint;
33

44
pub trait IsValid: Debug {
55
/// You'll need to redefine this if you want to use it on PointData.
@@ -35,20 +35,20 @@ impl<PD: PointData> IsValid for Point<PD> {
3535
fn is_valid(&self) -> bool {
3636
if let Some(pd) = self.data.as_ref() {
3737
if !pd.is_valid() {
38-
return false
38+
return false;
3939
}
4040
}
4141

4242
if self.ptype == PointType::Undefined {
43-
return false
43+
return false;
4444
}
4545
if self.x.is_nan() || self.y.is_subnormal() {
46-
return false
46+
return false;
4747
}
4848
for handle in [self.handle(WhichHandle::A), self.handle(WhichHandle::B)] {
4949
if let Handle::At(hx, hy) = handle {
5050
if hx.is_nan() || hy.is_subnormal() {
51-
return false
51+
return false;
5252
}
5353
}
5454
}
@@ -74,13 +74,23 @@ impl<PD: PointData> PointLike for Point<PD> {
7474
impl IsValid for GlifPoint {
7575
fn is_valid(&self) -> bool {
7676
if self.ptype == PointType::Undefined {
77-
return false
77+
return false;
7878
}
79-
if self.x.holding_float().map(|x| x.is_subnormal() || x.is_nan()).unwrap_or(false) {
80-
return false
79+
if self
80+
.x
81+
.holding_float()
82+
.map(|x| x.is_subnormal() || x.is_nan())
83+
.unwrap_or(false)
84+
{
85+
return false;
8186
}
82-
if self.y.holding_float().map(|y| y.is_subnormal() || y.is_nan()).unwrap_or(false) {
83-
return false
87+
if self
88+
.y
89+
.holding_float()
90+
.map(|y| y.is_subnormal() || y.is_nan())
91+
.unwrap_or(false)
92+
{
93+
return false;
8494
}
8595
true
8696
}

src/point/xml.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ impl GlifPoint {
1111
let ptype = self.ptype.to_string();
1212
match ptype.as_str() {
1313
"offcurve" => None, // while this name is OK, most often not written
14-
_ => el.attributes.insert("type".to_owned(), ptype)
14+
_ => el.attributes.insert("type".to_owned(), ptype),
1515
};
1616
match &self.name {
1717
Some(name) => el.attributes.insert("name".to_owned(), name.to_string()),
18-
None => None
18+
None => None,
1919
};
2020
if self.smooth {
2121
debug_assert!(self.ptype != PointType::OffCurve);

0 commit comments

Comments
 (0)