mirror of
https://github.com/typst/typst
synced 2025-06-28 08:12:53 +08:00
Bump Rust in CI (#4445)
This commit is contained in:
parent
e6b5314870
commit
45366c0112
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -30,7 +30,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@1.77.0
|
- uses: dtolnay/rust-toolchain@1.79.0
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: cargo test --workspace --no-run
|
- run: cargo test --workspace --no-run
|
||||||
- run: cargo test --workspace --no-fail-fast
|
- run: cargo test --workspace --no-fail-fast
|
||||||
@ -40,7 +40,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@1.77.0
|
- uses: dtolnay/rust-toolchain@1.79.0
|
||||||
with:
|
with:
|
||||||
components: clippy, rustfmt
|
components: clippy, rustfmt
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@1.77.0
|
- uses: dtolnay/rust-toolchain@1.79.0
|
||||||
with:
|
with:
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ pub fn write_images(context: &WithGlobalRefs) -> (PdfChunk, HashMap<Image, Ref>)
|
|||||||
svg_chunk.renumber_into(&mut chunk.chunk, |old| {
|
svg_chunk.renumber_into(&mut chunk.chunk, |old| {
|
||||||
*map.entry(old).or_insert_with(|| chunk.alloc.bump())
|
*map.entry(old).or_insert_with(|| chunk.alloc.bump())
|
||||||
});
|
});
|
||||||
out.insert(image.clone(), map[&id]);
|
out.insert(image.clone(), map[id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ fn convert_outline_glyph_to_path(
|
|||||||
/// Convert a bitmap glyph to an encoded image URL.
|
/// Convert a bitmap glyph to an encoded image URL.
|
||||||
#[comemo::memoize]
|
#[comemo::memoize]
|
||||||
fn convert_bitmap_glyph_to_image(font: &Font, id: GlyphId) -> Option<(Image, f64, f64)> {
|
fn convert_bitmap_glyph_to_image(font: &Font, id: GlyphId) -> Option<(Image, f64, f64)> {
|
||||||
let raster = font.ttf().glyph_raster_image(id, std::u16::MAX)?;
|
let raster = font.ttf().glyph_raster_image(id, u16::MAX)?;
|
||||||
if raster.format != ttf_parser::RasterImageFormat::PNG {
|
if raster.format != ttf_parser::RasterImageFormat::PNG {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -782,7 +782,7 @@ impl<T: NativeElement> Packed<T> {
|
|||||||
// Safety:
|
// Safety:
|
||||||
// - We have checked the type.
|
// - We have checked the type.
|
||||||
// - Packed<T> is repr(transparent).
|
// - Packed<T> is repr(transparent).
|
||||||
return Some(unsafe { std::mem::transmute(content) });
|
return Some(unsafe { std::mem::transmute::<&Content, &Packed<T>>(content) });
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
@ -793,7 +793,9 @@ impl<T: NativeElement> Packed<T> {
|
|||||||
// Safety:
|
// Safety:
|
||||||
// - We have checked the type.
|
// - We have checked the type.
|
||||||
// - Packed<T> is repr(transparent).
|
// - Packed<T> is repr(transparent).
|
||||||
return Some(unsafe { std::mem::transmute(content) });
|
return Some(unsafe {
|
||||||
|
std::mem::transmute::<&mut Content, &mut Packed<T>>(content)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
@ -804,7 +806,7 @@ impl<T: NativeElement> Packed<T> {
|
|||||||
// Safety:
|
// Safety:
|
||||||
// - We have checked the type.
|
// - We have checked the type.
|
||||||
// - Packed<T> is repr(transparent).
|
// - Packed<T> is repr(transparent).
|
||||||
return Ok(unsafe { std::mem::transmute(content) });
|
return Ok(unsafe { std::mem::transmute::<Content, Packed<T>>(content) });
|
||||||
}
|
}
|
||||||
Err(content)
|
Err(content)
|
||||||
}
|
}
|
||||||
|
@ -910,6 +910,7 @@ mod callbacks {
|
|||||||
// private field and `Content`'s `Clone` impl is
|
// private field and `Content`'s `Clone` impl is
|
||||||
// guaranteed to retain the type (if it didn't,
|
// guaranteed to retain the type (if it didn't,
|
||||||
// literally everything would break).
|
// literally everything would break).
|
||||||
|
#[allow(clippy::missing_transmute_annotations)]
|
||||||
f: unsafe { std::mem::transmute(f) },
|
f: unsafe { std::mem::transmute(f) },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ impl FontWeight {
|
|||||||
/// Create a font weight from a number between 100 and 900, clamping it if
|
/// Create a font weight from a number between 100 and 900, clamping it if
|
||||||
/// necessary.
|
/// necessary.
|
||||||
pub fn from_number(weight: u16) -> Self {
|
pub fn from_number(weight: u16) -> Self {
|
||||||
Self(weight.max(100).min(900))
|
Self(weight.clamp(100, 900))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The number between 100 and 900.
|
/// The number between 100 and 900.
|
||||||
@ -120,7 +120,7 @@ impl FontWeight {
|
|||||||
|
|
||||||
/// Add (or remove) weight, saturating at the boundaries of 100 and 900.
|
/// Add (or remove) weight, saturating at the boundaries of 100 and 900.
|
||||||
pub fn thicken(self, delta: i16) -> Self {
|
pub fn thicken(self, delta: i16) -> Self {
|
||||||
Self((self.0 as i16).saturating_add(delta).max(100).min(900) as u16)
|
Self((self.0 as i16).saturating_add(delta).clamp(100, 900) as u16)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The absolute number distance between this and another font weight.
|
/// The absolute number distance between this and another font weight.
|
||||||
@ -219,7 +219,7 @@ impl FontStretch {
|
|||||||
/// Create a font stretch from a ratio between 0.5 and 2.0, clamping it if
|
/// Create a font stretch from a ratio between 0.5 and 2.0, clamping it if
|
||||||
/// necessary.
|
/// necessary.
|
||||||
pub fn from_ratio(ratio: Ratio) -> Self {
|
pub fn from_ratio(ratio: Ratio) -> Self {
|
||||||
Self((ratio.get().max(0.5).min(2.0) * 1000.0) as u16)
|
Self((ratio.get().clamp(0.5, 2.0) * 1000.0) as u16)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a font stretch from an OpenType-style number between 1 and 9,
|
/// Create a font stretch from an OpenType-style number between 1 and 9,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user