1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Fix lints

This commit is contained in:
Hubert Głuchowski
2024-11-29 11:50:24 +01:00
parent db32a1ed44
commit 4e3f162801

View File

@@ -769,21 +769,20 @@ impl GalleyCache {
let mut galleys = Vec::new(); let mut galleys = Vec::new();
let mut text_left = job.text.as_str(); let mut text_left = job.text.as_str();
loop { loop {
let end = text_left let end = text_left.find('\n').map_or(job.text.len(), |i| i + current);
.find('\n') let start = current;
.map(|i| i + current)
.unwrap_or(job.text.len());
let mut line_job = LayoutJob::default(); let mut line_job = LayoutJob {
line_job.text = job.text[current..end].to_string(); text: job.text[current..end].to_string(),
line_job.wrap = crate::text::TextWrapping { wrap: crate::text::TextWrapping {
max_rows: left_max_rows, max_rows: left_max_rows,
..job.wrap ..job.wrap
},
halign: job.halign,
justify: job.justify,
..Default::default()
}; };
line_job.halign = job.halign;
line_job.justify = job.justify;
let line_start = current;
while current < end { while current < end {
let mut s = &job.sections[current_section]; let mut s = &job.sections[current_section];
while s.byte_range.end <= current { while s.byte_range.end <= current {
@@ -795,7 +794,7 @@ impl GalleyCache {
let section_end = s.byte_range.end.min(end); let section_end = s.byte_range.end.min(end);
line_job.sections.push(crate::text::LayoutSection { line_job.sections.push(crate::text::LayoutSection {
leading_space: s.leading_space, leading_space: s.leading_space,
byte_range: current - line_start..section_end - line_start, byte_range: current - start..section_end - start,
format: s.format.clone(), format: s.format.clone(),
}); });
current = section_end; current = section_end;