mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Use try syntax for Option where appropriate
This commit is contained in:
parent
fe16c1d5c3
commit
2d45e9d2da
19 changed files with 65 additions and 180 deletions
|
@ -2895,10 +2895,7 @@ impl Fragment {
|
|||
/// Returns the 4D matrix representing this fragment's transform.
|
||||
pub fn transform_matrix(&self, stacking_relative_border_box: &Rect<Au>) -> Option<Transform3D<f32>> {
|
||||
let list = &self.style.get_box().transform;
|
||||
let transform = match list.to_transform_3d_matrix(Some(stacking_relative_border_box)) {
|
||||
Some(transform) => transform,
|
||||
None => return None,
|
||||
};
|
||||
let transform = list.to_transform_3d_matrix(Some(stacking_relative_border_box))?;
|
||||
|
||||
let transform_origin = &self.style.get_box().transform_origin;
|
||||
let transform_origin_x =
|
||||
|
@ -3039,10 +3036,7 @@ impl<'a> Iterator for InlineStyleIterator<'a> {
|
|||
self.primary_style_yielded = true;
|
||||
return Some(&*self.fragment.style)
|
||||
}
|
||||
let inline_context = match self.fragment.inline_context {
|
||||
None => return None,
|
||||
Some(ref inline_context) => inline_context,
|
||||
};
|
||||
let inline_context = self.fragment.inline_context.as_ref()?;
|
||||
let inline_style_index = self.inline_style_index;
|
||||
if inline_style_index == inline_context.nodes.len() {
|
||||
return None
|
||||
|
|
|
@ -384,10 +384,7 @@ impl LineBreaker {
|
|||
-> Option<Fragment>
|
||||
where I: Iterator<Item=Fragment>,
|
||||
{
|
||||
let mut result = match self.next_fragment(old_fragment_iter) {
|
||||
None => return None,
|
||||
Some(fragment) => fragment,
|
||||
};
|
||||
let mut result = self.next_fragment(old_fragment_iter)?;
|
||||
|
||||
loop {
|
||||
let candidate = match self.next_fragment(old_fragment_iter) {
|
||||
|
|
|
@ -78,10 +78,7 @@ impl<'a, T> Iterator for PersistentListIterator<'a, T> where T: Send + Sync + 's
|
|||
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<&'a T> {
|
||||
let entry = match self.entry {
|
||||
None => return None,
|
||||
Some(entry) => entry,
|
||||
};
|
||||
let entry = self.entry?;
|
||||
let value = &entry.value;
|
||||
self.entry = match entry.next {
|
||||
None => None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue