Skip to content

Commit f54c0d6

Browse files
committed
[warnings] sugarloaf
1 parent 69bf9b1 commit f54c0d6

File tree

5 files changed

+10
-30
lines changed

5 files changed

+10
-30
lines changed

sugarloaf/src/font/cjk_metrics_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ mod tests {
195195

196196
#[test]
197197
fn test_multiple_latin_fonts_consistency() {
198-
let fonts = vec![
198+
let fonts = [
199199
TestFontData::cascadia_code(),
200200
TestFontData::dejavu_sans_mono(),
201201
];
@@ -414,7 +414,7 @@ mod tests {
414414

415415
#[test]
416416
fn test_baseline_consistency_across_font_combinations() {
417-
let fonts = vec![
417+
let fonts = [
418418
TestFontData::cascadia_code(),
419419
TestFontData::dejavu_sans_mono(),
420420
TestFontData::noto_sans_cjk(),

sugarloaf/src/font_introspector/attributes.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,9 @@ impl Default for ObliqueAngle {
336336
}
337337

338338
/// Visual style or 'slope' of a font.
339-
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
339+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)]
340340
pub enum Style {
341+
#[default]
341342
Normal,
342343
Italic,
343344
Oblique(ObliqueAngle),
@@ -437,12 +438,6 @@ impl fmt::Display for Style {
437438
}
438439
}
439440

440-
impl Default for Style {
441-
fn default() -> Self {
442-
Self::Normal
443-
}
444-
}
445-
446441
/// Visual weight class of a font on a scale from 1 to 1000.
447442
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash, Debug)]
448443
pub struct Weight(pub u16);

sugarloaf/src/font_introspector/scale/image.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,17 @@ use super::Source;
66
use zeno::Placement;
77

88
/// Content of a scaled glyph image.
9-
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
9+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)]
1010
pub enum Content {
1111
/// 8-bit alpha mask.
12+
#[default]
1213
Mask,
1314
/// 32-bit RGBA subpixel mask.
1415
SubpixelMask,
1516
/// 32-bit RGBA bitmap.
1617
Color,
1718
}
1819

19-
impl Default for Content {
20-
fn default() -> Self {
21-
Self::Mask
22-
}
23-
}
24-
2520
/// Scaled glyph image.
2621
#[derive(Clone, Default)]
2722
pub struct Image {

sugarloaf/src/font_introspector/scale/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,10 @@ pub enum StrikeWith {
263263
}
264264

265265
/// Glyph sources for the renderer.
266-
#[derive(Copy, Clone, Debug)]
266+
#[derive(Copy, Clone, Debug, Default)]
267267
pub enum Source {
268268
/// Scalable outlines.
269+
#[default]
269270
Outline,
270271
/// Layered color scalable outlines.
271272
ColorOutline(PaletteIndex),
@@ -275,12 +276,6 @@ pub enum Source {
275276
ColorBitmap(StrikeWith),
276277
}
277278

278-
impl Default for Source {
279-
fn default() -> Self {
280-
Self::Outline
281-
}
282-
}
283-
284279
/// Context that manages caches and scratch buffers for scaling.
285280
///
286281
/// See the module level [documentation](index.html#building-the-scaler) for detail.

sugarloaf/src/font_introspector/text/cluster/char.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl Default for Char {
4242
}
4343

4444
/// Shaping class of a character.
45-
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Debug)]
45+
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Debug, Default)]
4646
#[repr(u8)]
4747
pub enum ShapeClass {
4848
/// Reph form.
@@ -52,6 +52,7 @@ pub enum ShapeClass {
5252
/// Myanmar three character prefix.
5353
Kinzi,
5454
/// Base character.
55+
#[default]
5556
Base,
5657
/// Mark character.
5758
Mark,
@@ -78,9 +79,3 @@ pub enum ShapeClass {
7879
/// Other character.
7980
Other,
8081
}
81-
82-
impl Default for ShapeClass {
83-
fn default() -> Self {
84-
Self::Base
85-
}
86-
}

0 commit comments

Comments
 (0)