Skip to content

Commit bdccaeb

Browse files
committed
clippy
1 parent 408885f commit bdccaeb

2 files changed

Lines changed: 10 additions & 13 deletions

File tree

  • crates
    • processing_ffi/src
    • processing_render/src/render/primitive

crates/processing_ffi/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,8 +1060,8 @@ pub unsafe extern "C" fn processing_font_variation(
10601060
error::clear_error();
10611061
let font_entity = Entity::from_bits(font_id);
10621062
let axes = error::check(|| font_variations(font_entity));
1063-
if let Some(axes) = axes {
1064-
if let Some(axis) = axes.get(index as usize) {
1063+
if let Some(axes) = axes
1064+
&& let Some(axis) = axes.get(index as usize) {
10651065
let tag_bytes = axis.tag.as_bytes();
10661066
let len = tag_bytes.len().min(4);
10671067
unsafe {
@@ -1075,7 +1075,6 @@ pub unsafe extern "C" fn processing_font_variation(
10751075
}
10761076
return true;
10771077
}
1078-
}
10791078
false
10801079
}
10811080

crates/processing_render/src/render/primitive/text.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,10 @@ pub fn text_lines(
302302
};
303303
let metrics = line.metrics();
304304

305-
if let Some(h) = params.max_h {
306-
if metrics.baseline + metrics.descent > h {
305+
if let Some(h) = params.max_h
306+
&& metrics.baseline + metrics.descent > h {
307307
break;
308308
}
309-
}
310309

311310
let line_y = base_y + metrics.baseline - metrics.ascent;
312311
let line_text = &content[line.text_range()];
@@ -347,11 +346,10 @@ pub fn text_glyph_rects(
347346
};
348347
let metrics = line.metrics();
349348

350-
if let Some(h) = params.max_h {
351-
if metrics.baseline + metrics.descent > h {
349+
if let Some(h) = params.max_h
350+
&& metrics.baseline + metrics.descent > h {
352351
break;
353352
}
354-
}
355353

356354
for item in line.items() {
357355
let PositionedLayoutItem::GlyphRun(glyph_run) = item else {
@@ -1024,7 +1022,7 @@ fn tessellate_layout(
10241022
let font_data = run.font();
10251023
let font_size = run.font_size();
10261024
let normalized_coords = run.normalized_coords();
1027-
let color = glyph_run.style().brush.clone();
1025+
let color = glyph_run.style().brush;
10281026

10291027
let Ok(font_ref) = FontRef::from_index(font_data.data.as_ref(), font_data.index) else {
10301028
continue;
@@ -1044,7 +1042,7 @@ fn tessellate_layout(
10441042
let glyph_color = glyph_colors
10451043
.filter(|colors| !colors.is_empty())
10461044
.map(|colors| colors[glyph_index % colors.len()])
1047-
.unwrap_or(color.clone());
1045+
.unwrap_or(color);
10481046
glyph_index += 1;
10491047

10501048
let glyph_id = skrifa::GlyphId::new(glyph.id);
@@ -1061,7 +1059,7 @@ fn tessellate_layout(
10611059

10621060
let translated = translate_path_flip_y(&path, tx, ty);
10631061

1064-
let mut builder = MeshBuilder::new(mesh, glyph_color.clone());
1062+
let mut builder = MeshBuilder::new(mesh, glyph_color);
10651063
let _ = fill_tess.tessellate_path(
10661064
&translated,
10671065
&FillOptions::default(),
@@ -1088,7 +1086,7 @@ fn stroke_layout(
10881086

10891087
let glyph_paths = extract_glyph_lyon_paths(layout, base_x, base_y, max_h);
10901088
for path in &glyph_paths {
1091-
let mut builder = MeshBuilder::new(mesh, color.clone());
1089+
let mut builder = MeshBuilder::new(mesh, color);
10921090
let _ = stroke_tess.tessellate_path(path, &stroke_opts, &mut builder);
10931091
}
10941092
}

0 commit comments

Comments
 (0)