mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Use Option::expect instead of pattern matching in try_append_to_line_by_new_line
This commit is contained in:
parent
344af248e7
commit
762669b5c6
1 changed files with 22 additions and 25 deletions
|
@ -477,8 +477,10 @@ impl LineBreaker {
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
debug!("LineBreaker: Found a new-line character, so splitting theline.");
|
debug!("LineBreaker: Found a new-line character, so splitting theline.");
|
||||||
match in_fragment.find_split_info_by_new_line() {
|
|
||||||
Some((left, right, run)) => {
|
let (left, right, run) = in_fragment.find_split_info_by_new_line()
|
||||||
|
.expect("LineBreaker: This split case makes no sense!");
|
||||||
|
|
||||||
// TODO(bjz): Remove fragment splitting
|
// TODO(bjz): Remove fragment splitting
|
||||||
let split_fragment = |split: SplitInfo| {
|
let split_fragment = |split: SplitInfo| {
|
||||||
let info = ScannedTextFragmentInfo::new(run.clone(), split.range);
|
let info = ScannedTextFragmentInfo::new(run.clone(), split.range);
|
||||||
|
@ -490,7 +492,7 @@ impl LineBreaker {
|
||||||
debug!("LineBreaker: Pushing the fragment to the left of the new-line character \
|
debug!("LineBreaker: Pushing the fragment to the left of the new-line character \
|
||||||
to the line.");
|
to the line.");
|
||||||
let mut left = split_fragment(left);
|
let mut left = split_fragment(left);
|
||||||
left.new_line_pos = vec!();
|
left.new_line_pos = vec![];
|
||||||
self.push_fragment_to_line(left);
|
self.push_fragment_to_line(left);
|
||||||
|
|
||||||
for right in right.move_iter() {
|
for right in right.move_iter() {
|
||||||
|
@ -500,11 +502,6 @@ impl LineBreaker {
|
||||||
right.new_line_pos = in_fragment.new_line_pos.clone();
|
right.new_line_pos = in_fragment.new_line_pos.clone();
|
||||||
self.work_list.push_front(right);
|
self.work_list.push_front(right);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
None => {
|
|
||||||
error!("LineBreaker: This split case makes no sense!")
|
|
||||||
},
|
|
||||||
}
|
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue