Remove unnecessary result in line shaping (#30721)

Updates #29879

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2025-05-16 23:48:36 +02:00 committed by GitHub
parent d791c6cdb1
commit ff0060aa36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 118 additions and 155 deletions

View file

@ -481,8 +481,7 @@ impl Element for TextElement {
let font_size = style.font_size.to_pixels(window.rem_size());
let line = window
.text_system()
.shape_line(display_text, font_size, &runs)
.unwrap();
.shape_line(display_text, font_size, &runs);
let cursor_pos = line.x_for_index(cursor);
let (selection, cursor) = if selected_range.is_empty() {

View file

@ -343,7 +343,7 @@ impl WindowTextSystem {
text: SharedString,
font_size: Pixels,
runs: &[TextRun],
) -> Result<ShapedLine> {
) -> ShapedLine {
debug_assert!(
text.find('\n').is_none(),
"text argument should not contain newlines"
@ -370,13 +370,13 @@ impl WindowTextSystem {
});
}
let layout = self.layout_line(&text, font_size, runs)?;
let layout = self.layout_line(&text, font_size, runs);
Ok(ShapedLine {
ShapedLine {
layout,
text,
decoration_runs,
})
}
}
/// Shape a multi line string of text, at the given font_size, for painting to the screen.
@ -510,7 +510,7 @@ impl WindowTextSystem {
text: Text,
font_size: Pixels,
runs: &[TextRun],
) -> Result<Arc<LineLayout>>
) -> Arc<LineLayout>
where
Text: AsRef<str>,
SharedString: From<Text>,
@ -537,7 +537,7 @@ impl WindowTextSystem {
font_runs.clear();
self.font_runs_pool.lock().push(font_runs);
Ok(layout)
layout
}
}