Skip to content

Commit 1f32904

Browse files
committed
Please the paperclip
1 parent 2cc5f9c commit 1f32904

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/shape.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
use crate::fallback::FontFallbackIter;
66
use crate::{
7-
math, Align, AttrsList, CacheKeyFlags, Color, Font, FontSystem, LayoutGlyph,
8-
LayoutLine, Metrics, Wrap,
7+
math, Align, AttrsList, CacheKeyFlags, Color, Font, FontSystem, LayoutGlyph, LayoutLine,
8+
Metrics, Wrap,
99
};
1010
#[cfg(not(feature = "std"))]
1111
use alloc::vec::Vec;
1212

13+
use alloc::collections::VecDeque;
1314
use core::cmp::{max, min};
1415
use core::fmt;
1516
use core::mem;
1617
use core::ops::Range;
17-
use alloc::collections::VecDeque;
1818

1919
#[cfg(not(feature = "std"))]
2020
use core_maths::CoreFloat;
@@ -84,7 +84,7 @@ const NUM_SHAPE_PLANS: usize = 4;
8484
/// A set of buffers containing allocations for shaped text.
8585
#[derive(Default)]
8686
pub struct ShapeBuffer {
87-
/// Cache for HarfRust shape plans. Stores up to [`NUM_SHAPE_PLANS`] plans at once. Inserting a new one past that
87+
/// Cache for harfrust shape plans. Stores up to [`NUM_SHAPE_PLANS`] plans at once. Inserting a new one past that
8888
/// will remove the one that was least recently added (not least recently used).
8989
shape_plan_cache: VecDeque<harfrust::ShapePlan>,
9090

@@ -186,13 +186,16 @@ fn shape_fallback(
186186
scratch.shape_plan_cache.pop_front();
187187
}
188188
scratch.shape_plan_cache.push_back(plan);
189-
scratch.shape_plan_cache.back().unwrap()
189+
scratch
190+
.shape_plan_cache
191+
.back()
192+
.expect("we just pushed the shape plan")
190193
}
191194
};
192195

193196
let glyph_buffer = font
194197
.shaper()
195-
.shape_with_plan(&shape_plan, buffer, &rb_font_features);
198+
.shape_with_plan(shape_plan, buffer, &rb_font_features);
196199
let glyph_infos = glyph_buffer.glyph_infos();
197200
let glyph_positions = glyph_buffer.glyph_positions();
198201

0 commit comments

Comments
 (0)