Bug 1607697 - Address clippy lints about nested branches. r=Gankro

Differential Revision: https://phabricator.services.mozilla.com/D59115

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Silva 2020-01-10 10:12:16 +00:00
Родитель a5e19cec49
Коммит 9a61098486
6 изменённых файлов: 41 добавлений и 49 удалений

Просмотреть файл

@ -2009,12 +2009,11 @@ impl TileCacheInstance {
// If the clip has the same spatial node, the relative transform
// will always be the same, so there's no need to depend on it.
let clip_node = &data_stores.clip[clip_instance.handle];
if clip_node.item.spatial_node_index != self.spatial_node_index {
if !prim_info.spatial_nodes.contains(&clip_node.item.spatial_node_index) {
if clip_node.item.spatial_node_index != self.spatial_node_index
&& !prim_info.spatial_nodes.contains(&clip_node.item.spatial_node_index) {
prim_info.spatial_nodes.push(clip_node.item.spatial_node_index);
}
}
}
// Certain primitives may select themselves to be a backdrop candidate, which is
// then applied below.
@ -2123,13 +2122,13 @@ impl TileCacheInstance {
// If a text run is on a child surface, the subpx mode will be
// correctly determined as we recurse through pictures in take_context.
if on_picture_surface && subpx_requested {
if !self.backdrop.rect.contains_rect(&pic_clip_rect) {
if on_picture_surface
&& subpx_requested
&& !self.backdrop.rect.contains_rect(&pic_clip_rect) {
self.subpixel_mode = SubpixelMode::Deny;
}
}
}
}
PrimitiveInstanceKind::Clear { .. } => {
backdrop_candidate = Some(BackdropKind::Clear);
}
@ -2175,13 +2174,13 @@ impl TileCacheInstance {
}
};
if is_suitable_backdrop {
if !prim_clip_chain.needs_mask && pic_clip_rect.contains_rect(&self.backdrop.rect) {
if is_suitable_backdrop
&& !prim_clip_chain.needs_mask
&& pic_clip_rect.contains_rect(&self.backdrop.rect) {
self.backdrop = BackdropInfo {
rect: pic_clip_rect,
kind: backdrop_candidate,
}
}
};
}
}
@ -4405,14 +4404,12 @@ impl PicturePrimitive {
debug_assert_eq!(surface_index, raster_config.surface_index);
// Check if any of the surfaces can't be rasterized in local space but want to.
if raster_config.establishes_raster_root {
if surface_rect.size.width > MAX_SURFACE_SIZE ||
surface_rect.size.height > MAX_SURFACE_SIZE
{
if raster_config.establishes_raster_root
&& (surface_rect.size.width > MAX_SURFACE_SIZE
|| surface_rect.size.height > MAX_SURFACE_SIZE) {
raster_config.establishes_raster_root = false;
state.are_raster_roots_assigned = false;
}
}
// Set the estimated and precise local rects. The precise local rect
// may be changed again during frame visibility.

Просмотреть файл

@ -2018,11 +2018,9 @@ impl PrimitiveStore {
let pic = &self.pictures[pic_index.0];
prim_instance.prim_origin = pic.precise_local_rect.origin;
if prim_instance.is_chased() {
if pic.estimated_local_rect != pic.precise_local_rect {
if prim_instance.is_chased() && pic.estimated_local_rect != pic.precise_local_rect {
println!("\testimate {:?} adjusted to {:?}", pic.estimated_local_rect, pic.precise_local_rect);
}
}
let mut shadow_rect = pic.precise_local_rect;
match pic.raster_config {
@ -2253,9 +2251,11 @@ impl PrimitiveStore {
frame_state.scratch.push_debug_rect(debug_rect, debug_color, debug_color.scale_alpha(0.5));
}
} else if frame_context.debug_flags.contains(::api::DebugFlags::OBSCURE_IMAGES) {
if matches!(prim_instance.kind, PrimitiveInstanceKind::Image { .. } |
PrimitiveInstanceKind::YuvImage { .. })
{
let is_image = matches!(
prim_instance.kind,
PrimitiveInstanceKind::Image { .. } | PrimitiveInstanceKind::YuvImage { .. }
);
if is_image {
// We allow "small" images, since they're generally UI elements.
let rect = clipped_world_rect * frame_context.global_device_pixel_scale;
if rect.size.width > 70.0 && rect.size.height > 70.0 {

Просмотреть файл

@ -456,12 +456,11 @@ impl Document {
}
};
if self.hit_tester.is_some() {
if self.scroll_nearest_scrolling_ancestor(delta, node_index) {
if self.hit_tester.is_some()
&& self.scroll_nearest_scrolling_ancestor(delta, node_index) {
self.hit_tester_is_valid = false;
self.frame_is_valid = false;
}
}
return DocumentOps {
// TODO: Does it make sense to track this as a scrolling even if we

Просмотреть файл

@ -3131,7 +3131,7 @@ impl Renderer {
doc_index == 0,
);
if let Some(_) = device_size {
if device_size.is_some() {
self.draw_frame_debug_items(&frame.debug_items);
}
if self.debug_flags.contains(DebugFlags::PROFILER_DBG) {

Просмотреть файл

@ -786,8 +786,7 @@ impl ResourceCache {
_ => {}
}
} else {
if let RasterizedBlob::NonTiled(ref mut queue) = *image {
} else if let RasterizedBlob::NonTiled(ref mut queue) = *image {
// If our new rasterized rect overwrites items in the queue, discard them.
queue.retain(|img| {
!data.rasterized_rect.contains_rect(&img.rasterized_rect)
@ -799,7 +798,6 @@ impl ResourceCache {
}
}
}
}
pub fn add_font_template(&mut self, font_key: FontKey, template: FontTemplate) {
// Push the new font to the font renderer, and also store

Просмотреть файл

@ -673,12 +673,10 @@ impl SceneBuilderThread {
if let &Some(ref hooks) = &self.hooks {
hooks.post_resource_update(&have_resources_updates);
}
} else {
if let &Some(ref hooks) = &self.hooks {
} else if let Some(ref hooks) = self.hooks {
hooks.post_empty_scene_build();
}
}
}
/// Reports CPU heap memory used by the SceneBuilder.
fn report_memory(&mut self) -> MemoryReport {