Bug 1617369 - Reformat recent rust changes with rustfmt r=emilio
rustfmt 1.7.0-stable (129f3b9 2024-06-10) # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D215916
This commit is contained in:
@@ -262,9 +262,7 @@ impl WrVecU8 {
|
||||
//
|
||||
// For the empty case we follow this requirement rather than the more stringent
|
||||
// requirement from the `Vec::from_raw_parts` docs.
|
||||
let vec = unsafe {
|
||||
Vec::from_raw_parts(self.data, self.length, self.capacity)
|
||||
};
|
||||
let vec = unsafe { Vec::from_raw_parts(self.data, self.length, self.capacity) };
|
||||
self.data = ptr::NonNull::dangling().as_ptr();
|
||||
self.length = 0;
|
||||
self.capacity = 0;
|
||||
@@ -2386,8 +2384,11 @@ pub extern "C" fn wr_api_stop_capture_sequence(dh: &mut DocumentHandle) {
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn read_font_descriptor(bytes: &mut WrVecU8, index: u32) -> NativeFontHandle {
|
||||
let wchars: Vec<u16> =
|
||||
bytes.as_slice().chunks_exact(2).map(|c| u16::from_ne_bytes([c[0], c[1]])).collect();
|
||||
let wchars: Vec<u16> = bytes
|
||||
.as_slice()
|
||||
.chunks_exact(2)
|
||||
.map(|c| u16::from_ne_bytes([c[0], c[1]]))
|
||||
.collect();
|
||||
NativeFontHandle {
|
||||
path: PathBuf::from(OsString::from_wide(&wchars)),
|
||||
index,
|
||||
@@ -2447,13 +2448,16 @@ pub extern "C" fn wr_resource_updates_add_font_instance(
|
||||
// Every FontVariation is 8 bytes: one u32 and one f32.
|
||||
// The code below would look better with slice::chunk_arrays:
|
||||
// https://github.com/rust-lang/rust/issues/74985
|
||||
let variations: Vec<FontVariation> =
|
||||
variations.as_slice().chunks_exact(8).map(|c| {
|
||||
let variations: Vec<FontVariation> = variations
|
||||
.as_slice()
|
||||
.chunks_exact(8)
|
||||
.map(|c| {
|
||||
assert_eq!(c.len(), 8);
|
||||
let tag = u32::from_ne_bytes([c[0], c[1], c[2], c[3]]);
|
||||
let value = f32::from_ne_bytes([c[4], c[5], c[6], c[7]]);
|
||||
FontVariation { tag, value }
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
txn.add_font_instance(
|
||||
key,
|
||||
font_key,
|
||||
@@ -2837,18 +2841,18 @@ pub extern "C" fn wr_dp_define_sticky_frame(
|
||||
horizontal_bounds: StickyOffsetBounds,
|
||||
applied_offset: LayoutVector2D,
|
||||
key: SpatialTreeItemKey,
|
||||
animation: *const WrAnimationProperty
|
||||
animation: *const WrAnimationProperty,
|
||||
) -> WrSpatialId {
|
||||
assert!(unsafe { is_in_main_thread() });
|
||||
let anim = unsafe { animation.as_ref() };
|
||||
let transform = anim.map(|anim| {
|
||||
debug_assert!(anim.id > 0);
|
||||
match anim.effect_type {
|
||||
WrAnimationType::Transform => {
|
||||
PropertyBinding::Binding(PropertyBindingKey::new(anim.id), LayoutTransform::identity())
|
||||
},
|
||||
_ => unreachable!("sticky elements can only have a transform animated")
|
||||
}
|
||||
debug_assert!(anim.id > 0);
|
||||
match anim.effect_type {
|
||||
WrAnimationType::Transform => {
|
||||
PropertyBinding::Binding(PropertyBindingKey::new(anim.id), LayoutTransform::identity())
|
||||
},
|
||||
_ => unreachable!("sticky elements can only have a transform animated"),
|
||||
}
|
||||
});
|
||||
let spatial_id = state.frame_builder.dl_builder.define_sticky_frame(
|
||||
parent_spatial_id.to_webrender(state.pipeline_id),
|
||||
@@ -2863,7 +2867,7 @@ pub extern "C" fn wr_dp_define_sticky_frame(
|
||||
horizontal_bounds,
|
||||
applied_offset,
|
||||
key,
|
||||
transform
|
||||
transform,
|
||||
);
|
||||
|
||||
WrSpatialId { id: spatial_id.0 }
|
||||
|
||||
@@ -43,9 +43,7 @@ impl UnicodeBidi<'_> {
|
||||
};
|
||||
let adapter = BidiClassAdapter::new(maps::bidi_class());
|
||||
Box::new(UnicodeBidi {
|
||||
paragraph_info: utf16::ParagraphBidiInfo::new_with_data_source(
|
||||
&adapter, text, level,
|
||||
),
|
||||
paragraph_info: utf16::ParagraphBidiInfo::new_with_data_source(&adapter, text, level),
|
||||
resolved: None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -28,7 +28,10 @@ fn read_image_digest(path: &str) -> Result<String> {
|
||||
.stdout(std::process::Stdio::piped())
|
||||
.spawn()?
|
||||
.wait_with_output()?;
|
||||
ensure!(output.status.success(), format!("Could not inspect parent image: {}", output.status));
|
||||
ensure!(
|
||||
output.status.success(),
|
||||
format!("Could not inspect parent image: {}", output.status)
|
||||
);
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
@@ -73,9 +76,15 @@ fn build_image(
|
||||
.args(&["--destination", "image"])
|
||||
.args(&["--dockerfile", "Dockerfile"])
|
||||
.args(&["--no-push", "--no-push-cache"])
|
||||
.args(&["--cache=true", "--cache-dir", "/workspace/cache", "--cache-repo", "oci:/workspace/repo"])
|
||||
.args(&[
|
||||
"--cache=true",
|
||||
"--cache-dir",
|
||||
"/workspace/cache",
|
||||
"--cache-repo",
|
||||
"oci:/workspace/repo",
|
||||
])
|
||||
.arg("--single-snapshot")
|
||||
// Compressed caching causes OOM with large images
|
||||
// Compressed caching causes OOM with large images
|
||||
.arg("--compressed-caching=false")
|
||||
// FIXME: Generating reproducible layers currently causes OOM.
|
||||
// .arg("--reproducible")
|
||||
@@ -88,7 +97,10 @@ fn build_image(
|
||||
command.args(&["--build-arg", &format!("{}={}", key, value)]);
|
||||
}
|
||||
let status = command.status()?;
|
||||
ensure!(status.success(), format!("Could not build image: {}", status));
|
||||
ensure!(
|
||||
status.success(),
|
||||
format!("Could not build image: {}", status)
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -99,7 +111,10 @@ fn repack_image(source: &str, dest: &str, image_name: &str) -> Result<()> {
|
||||
.arg(format!("docker-archive:{}:{}", dest, image_name))
|
||||
.stderr(std::process::Stdio::inherit())
|
||||
.status()?;
|
||||
ensure!(status.success(), format!("Could not repack image: {}", status));
|
||||
ensure!(
|
||||
status.success(),
|
||||
format!("Could not repack image: {}", status)
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,9 @@ impl ProcessReader {
|
||||
let notes_size = program_header.p_memsz as usize;
|
||||
let notes_bytes = self.copy_array(notes_address, notes_size)?;
|
||||
while notes_offset < notes_size {
|
||||
if let Ok((note, size)) = Note::try_from_ctx(¬es_bytes[notes_offset..notes_size], (4, context)) {
|
||||
if let Ok((note, size)) =
|
||||
Note::try_from_ctx(¬es_bytes[notes_offset..notes_size], (4, context))
|
||||
{
|
||||
if note.n_type == note_type && note.name == note_name {
|
||||
return Ok(notes_address + notes_offset);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user