Skip to content

Commit 0cd3d8b

Browse files
authored
Use bitflags 2.4 (#220)
1 parent 2ea57b3 commit 0cd3d8b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ source-fontconfig-default = ["source-fontconfig"]
2020
source = []
2121

2222
[dependencies]
23-
bitflags = "1"
23+
bitflags = "2.4"
2424
byteorder = "1.2"
2525
float-ord = "0.3"
2626
lazy_static = "1.1"

src/outline.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub struct Contour {
5050

5151
bitflags! {
5252
/// Flags that specify what type of point the corresponding position represents.
53+
#[derive(Clone, Debug, PartialEq)]
5354
pub struct PointFlags: u8 {
5455
/// This point is the control point of a quadratic Bézier curve or the first control point
5556
/// of a cubic Bézier curve.
@@ -117,20 +118,20 @@ impl Contour {
117118
sink.move_to(self.positions[0]);
118119

119120
let mut iter = self.positions[1..].iter().zip(self.flags[1..].iter());
120-
while let Some((&position_0, &flags_0)) = iter.next() {
121-
if flags_0 == PointFlags::empty() {
121+
while let Some((&position_0, ref flags_0)) = iter.next() {
122+
if flags_0.is_empty() {
122123
sink.line_to(position_0);
123124
continue;
124125
}
125126

126-
let (&position_1, &flags_1) = iter.next().expect("Invalid outline!");
127-
if flags_1 == PointFlags::empty() {
127+
let (&position_1, ref flags_1) = iter.next().expect("Invalid outline!");
128+
if flags_1.is_empty() {
128129
sink.quadratic_curve_to(position_0, position_1);
129130
continue;
130131
}
131132

132-
let (&position_2, &flags_2) = iter.next().expect("Invalid outline!");
133-
debug_assert_eq!(flags_2, PointFlags::empty());
133+
let (&position_2, ref flags_2) = iter.next().expect("Invalid outline!");
134+
debug_assert!(flags_2.is_empty());
134135
sink.cubic_curve_to(LineSegment2F::new(position_0, position_1), position_2);
135136
}
136137

0 commit comments

Comments
 (0)