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