diff --git a/crates/typst/src/image.rs b/crates/typst/src/image.rs index 05672e2a8..40dad6152 100644 --- a/crates/typst/src/image.rs +++ b/crates/typst/src/image.rs @@ -4,6 +4,7 @@ use std::cell::RefCell; use std::collections::BTreeMap; use std::fmt::{self, Debug, Formatter}; use std::io; +use std::rc::Rc; use std::sync::Arc; use comemo::{Prehashed, Track, Tracked}; @@ -126,7 +127,7 @@ impl Image { } /// The decoded version of the image. - pub fn decoded(&self) -> Arc { + pub fn decoded(&self) -> Rc { match self.format() { ImageFormat::Raster(format) => decode_raster(self.data(), format), ImageFormat::Vector(VectorFormat::Svg) => { @@ -265,7 +266,7 @@ pub struct IccProfile(pub Vec); /// Decode a raster image. #[comemo::memoize] -fn decode_raster(data: &Bytes, format: RasterFormat) -> StrResult> { +fn decode_raster(data: &Bytes, format: RasterFormat) -> StrResult> { fn decode_with<'a, T: ImageDecoder<'a>>( decoder: ImageResult, ) -> ImageResult<(image::DynamicImage, Option)> { @@ -284,7 +285,7 @@ fn decode_raster(data: &Bytes, format: RasterFormat) -> StrResult StrResult, -) -> StrResult> { +) -> StrResult> { // Disable usvg's default to "Times New Roman". Instead, we default to // the empty family and later, when we traverse the SVG, we check for // empty and non-existing family names and replace them with the true @@ -304,7 +305,7 @@ fn decode_svg( let fontdb = load_svg_fonts(&tree, loader); tree.convert_text(&fontdb); } - Ok(Arc::new(DecodedImage::Svg(tree))) + Ok(Rc::new(DecodedImage::Svg(tree))) } /// Discover and load the fonts referenced by an SVG. diff --git a/crates/typst/src/model/styles.rs b/crates/typst/src/model/styles.rs index 3a6a0b98a..751726806 100644 --- a/crates/typst/src/model/styles.rs +++ b/crates/typst/src/model/styles.rs @@ -42,7 +42,7 @@ impl Styles { /// Apply outer styles. Like [`chain`](StyleChain::chain), but in-place. pub fn apply(&mut self, mut outer: Self) { - outer.0.extend(mem::take(self).0.into_iter()); + outer.0.extend(mem::take(self).0); *self = outer; } @@ -53,7 +53,7 @@ impl Styles { /// Apply a slice of outer styles. pub fn apply_slice(&mut self, outer: &[Prehashed