Skip to content

Commit

Permalink
Bug 1617369 - Reformat recent rust changes with rustfmt r=necko-revie…
Browse files Browse the repository at this point in the history
…wers,kershaw

Updated with rustfmt 1.4.37-stable (f1edd04 2021-11-29)

Depends on D132868

Differential Revision: https://phabricator.services.mozilla.com/D132869
  • Loading branch information
abpostelnicu committed Dec 6, 2021
1 parent 6564c95 commit b98a74f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 42 deletions.
30 changes: 15 additions & 15 deletions gfx/webrender_bindings/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ use webrender::{
CompositorCapabilities, CompositorConfig, CompositorSurfaceTransform, DebugFlags, Device, MappableCompositor,
MappedTileInfo, NativeSurfaceId, NativeSurfaceInfo, NativeTileId, PartialPresentCompositor, PipelineInfo,
ProfilerHooks, RecordedFrameHandle, Renderer, RendererOptions, RendererStats, SWGLCompositeSurfaceInfo,
SceneBuilderHooks, ShaderPrecacheFlags, Shaders, SharedShaders, TextureCacheConfig, UploadMethod,
ONE_TIME_USAGE_HINT, WindowVisibility,
SceneBuilderHooks, ShaderPrecacheFlags, Shaders, SharedShaders, TextureCacheConfig, UploadMethod, WindowVisibility,
ONE_TIME_USAGE_HINT,
};
use wr_malloc_size_of::MallocSizeOfOps;

Expand Down Expand Up @@ -403,7 +403,7 @@ impl ExternalImageHandler for WrExternalImageHandler {
WrExternalImageType::NativeTexture => ExternalImageSource::NativeTexture(image.handle),
WrExternalImageType::RawData => {
ExternalImageSource::RawData(unsafe { make_slice(image.buff, image.size) })
},
}
WrExternalImageType::Invalid => ExternalImageSource::Invalid,
},
}
Expand Down Expand Up @@ -624,7 +624,7 @@ pub extern "C" fn wr_renderer_render(
*out_stats = results.stats;
out_dirty_rects.extend(results.dirty_rects);
true
},
}
Err(errors) => {
for e in errors {
warn!(" Failed to render: {:?}", e);
Expand All @@ -634,7 +634,7 @@ pub extern "C" fn wr_renderer_render(
}
}
false
},
}
}
}

Expand Down Expand Up @@ -1053,7 +1053,7 @@ impl AsyncPropertySampler for SamplerCallback {
Some(id) => {
generated_frame_id_value = id;
&generated_frame_id_value
},
}
None => ptr::null_mut(),
};
let mut transaction = Transaction::new();
Expand Down Expand Up @@ -1150,7 +1150,7 @@ pub unsafe extern "C" fn remove_program_binary_disk_cache(prof_path: &nsAString)
Err(_) => {
error!("Failed to remove program binary disk cache");
false
},
}
}
}

Expand Down Expand Up @@ -1696,7 +1696,7 @@ pub extern "C" fn wr_window_new(
}
*out_err = msg.into_raw();
return false;
},
}
};

unsafe {
Expand Down Expand Up @@ -2252,11 +2252,11 @@ fn generate_capture_path(path: *const c_char) -> Option<PathBuf> {
writeln!(file, "mozilla-central {}", moz_revision).unwrap();
}
Some(path)
},
}
Err(e) => {
warn!("Unable to create path '{:?}' for capture: {:?}", path, e);
None
},
}
}
}

Expand Down Expand Up @@ -2306,7 +2306,7 @@ fn read_font_descriptor(bytes: &mut WrVecU8, _index: u32) -> NativeFontHandle {
// Lucida Grande is the fallback font in Gecko, so use that here.
CGFont::from_name(&CFString::from_static_string("Lucida Grande"))
.expect("Failed reading font descriptor and could not load fallback font")
},
}
};
NativeFontHandle(font)
}
Expand Down Expand Up @@ -2537,7 +2537,7 @@ pub extern "C" fn wr_dp_push_stacking_context(
1.0,
));
has_opacity_animation = true;
},
}
WrAnimationType::Transform => {
transform_binding = Some((
PropertyBinding::Binding(
Expand All @@ -2549,7 +2549,7 @@ pub extern "C" fn wr_dp_push_stacking_context(
),
anim.key,
));
},
}
_ => unreachable!("{:?} should not create a stacking context", anim.effect_type),
}
}
Expand Down Expand Up @@ -2577,7 +2577,7 @@ pub extern "C" fn wr_dp_push_stacking_context(
Some(scroll_id) => {
debug_assert_eq!(params.reference_frame_kind, WrReferenceFrameKind::Perspective);
Some(ExternalScrollId(*scroll_id, state.pipeline_id))
},
}
None => None,
};

Expand Down Expand Up @@ -3975,7 +3975,7 @@ pub extern "C" fn wr_shaders_new(
gfx_critical_note(msg.as_ptr());
}
return ptr::null_mut();
},
}
}));

let shaders = WrShaders(shaders);
Expand Down
6 changes: 3 additions & 3 deletions gfx/webrender_bindings/src/moz2d_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,10 +683,10 @@ impl BlobImageHandler for Moz2dBlobImageHandler {
*visible_rect,
));
command.visible_rect = *visible_rect;
},
}
_ => {
panic!("missing image key");
},
}
}
}

Expand Down Expand Up @@ -815,7 +815,7 @@ impl Moz2dBlobImageHandler {
},
FontTemplate::Native(ref handle) => {
process_native_font_handle(instance.font_key, handle);
},
}
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions gfx/webrender_bindings/src/program_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn deserialize_program_binary(path: &Path) -> Result<Arc<ProgramBinary>, Error>
ErrorKind::InvalidData,
"Failed to deserialize ProgramBinary",
))
},
}
};

Ok(Arc::new(binary))
Expand Down Expand Up @@ -204,10 +204,10 @@ impl WrProgramBinaryDiskCache {
match deserialize_program_binary(&path) {
Ok(program) => {
program_cache.load_program_binary(program);
},
}
Err(err) => {
error!("shader-cache: Failed to deserialize program binary: {}", err);
},
}
};
} else {
info!("shader-cache: Program binary not found in disk cache");
Expand All @@ -229,7 +229,7 @@ impl WrProgramBinaryDiskCache {
Err(err) => {
info!("shader-cache: Could not read startup whitelist: {}", err);
Vec::new()
},
}
};
info!("Loaded startup shader whitelist in {:?}", start.elapsed());

Expand Down
16 changes: 7 additions & 9 deletions gfx/wgpu_bindings/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,15 +778,13 @@ pub unsafe extern "C" fn wgpu_client_create_bind_group_layout(
has_dynamic_offset: entry.has_dynamic_offset,
min_binding_size: entry.min_binding_size,
},
RawBindingType::Sampler => wgt::BindingType::Sampler(
if entry.sampler_compare {
wgt::SamplerBindingType::Comparison
} else if entry.sampler_filter {
wgt::SamplerBindingType::Filtering
} else {
wgt::SamplerBindingType::NonFiltering
}
),
RawBindingType::Sampler => wgt::BindingType::Sampler(if entry.sampler_compare {
wgt::SamplerBindingType::Comparison
} else if entry.sampler_filter {
wgt::SamplerBindingType::Filtering
} else {
wgt::SamplerBindingType::NonFiltering
}),
RawBindingType::SampledTexture => wgt::BindingType::Texture {
//TODO: the spec has a bug here
view_dimension: *entry
Expand Down
29 changes: 18 additions & 11 deletions netwerk/socket/neqo_glue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,10 @@ pub extern "C" fn neqo_http3conn_priority_update(
return NS_ERROR_INVALID_ARG;
}
let priority = Priority::new(urgency, incremental);
match conn.conn.priority_update(StreamId::from(stream_id), priority) {
match conn
.conn
.priority_update(StreamId::from(stream_id), priority)
{
Ok(_) => NS_OK,
Err(_) => NS_ERROR_UNEXPECTED,
}
Expand Down Expand Up @@ -693,12 +696,13 @@ pub extern "C" fn neqo_http3conn_event(
) -> nsresult {
while let Some(evt) = conn.conn.next_event() {
let fe = match evt {
Http3ClientEvent::DataWritable { stream_id } => {
Http3Event::DataWritable { stream_id: stream_id.as_u64() }
}
Http3ClientEvent::StopSending { stream_id, error } => {
Http3Event::StopSending { stream_id: stream_id.as_u64(), error }
}
Http3ClientEvent::DataWritable { stream_id } => Http3Event::DataWritable {
stream_id: stream_id.as_u64(),
},
Http3ClientEvent::StopSending { stream_id, error } => Http3Event::StopSending {
stream_id: stream_id.as_u64(),
error,
},
Http3ClientEvent::HeaderReady {
stream_id,
headers,
Expand All @@ -713,12 +717,15 @@ pub extern "C" fn neqo_http3conn_event(
if res != NS_OK {
return res;
}
Http3Event::HeaderReady { stream_id: stream_id.as_u64(), fin }
Http3Event::HeaderReady {
stream_id: stream_id.as_u64(),
fin,
}
}
}
Http3ClientEvent::DataReadable { stream_id } => {
Http3Event::DataReadable { stream_id: stream_id.as_u64() }
}
Http3ClientEvent::DataReadable { stream_id } => Http3Event::DataReadable {
stream_id: stream_id.as_u64(),
},
Http3ClientEvent::Reset {
stream_id,
error,
Expand Down

0 comments on commit b98a74f

Please sign in to comment.