mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Make clippy a bit happier
This commit is contained in:
parent
470f8001a1
commit
65c0c5607e
@ -54,6 +54,7 @@ impl Debug for Image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Caches decoded images.
|
/// Caches decoded images.
|
||||||
|
#[derive(Default)]
|
||||||
pub struct ImageCache {
|
pub struct ImageCache {
|
||||||
/// Maps from file hashes to ids of decoded images.
|
/// Maps from file hashes to ids of decoded images.
|
||||||
images: HashMap<ImageId, Image>,
|
images: HashMap<ImageId, Image>,
|
||||||
@ -64,7 +65,7 @@ pub struct ImageCache {
|
|||||||
impl ImageCache {
|
impl ImageCache {
|
||||||
/// Create a new, empty image cache.
|
/// Create a new, empty image cache.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self { images: HashMap::new(), on_load: None }
|
Self::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Load and decode an image file from a path.
|
/// Load and decode an image file from a path.
|
||||||
|
@ -21,7 +21,7 @@ pub struct LayoutCache {
|
|||||||
impl LayoutCache {
|
impl LayoutCache {
|
||||||
/// Create a new, empty layout cache.
|
/// Create a new, empty layout cache.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self { frames: HashMap::new(), age: 0 }
|
Self::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear the cache.
|
/// Clear the cache.
|
||||||
|
@ -285,7 +285,7 @@ fn split_runs<'a>(
|
|||||||
range: Range,
|
range: Range,
|
||||||
) -> impl Iterator<Item = (Range, Dir)> + 'a {
|
) -> impl Iterator<Item = (Range, Dir)> + 'a {
|
||||||
let mut cursor = range.start;
|
let mut cursor = range.start;
|
||||||
bidi.levels[range.clone()]
|
bidi.levels[range]
|
||||||
.group_by_key(|&level| level)
|
.group_by_key(|&level| level)
|
||||||
.map(move |(level, group)| {
|
.map(move |(level, group)| {
|
||||||
let start = cursor;
|
let start = cursor;
|
||||||
|
@ -235,9 +235,8 @@ fn shape_segment<'a>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match ctx.cache.font.select(ctx.loader, family, variant) {
|
if let Some(id) = ctx.cache.font.select(ctx.loader, family, variant) {
|
||||||
Some(id) => break (id, true),
|
break (id, true);
|
||||||
None => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We're out of families, so we don't do any more fallback and just
|
// We're out of families, so we don't do any more fallback and just
|
||||||
|
@ -204,7 +204,8 @@ pub fn lang(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
|
|||||||
fn lang_dir(iso: &str) -> Dir {
|
fn lang_dir(iso: &str) -> Dir {
|
||||||
match iso.to_ascii_lowercase().as_str() {
|
match iso.to_ascii_lowercase().as_str() {
|
||||||
"ar" | "he" | "fa" | "ur" | "ps" | "yi" => Dir::RTL,
|
"ar" | "he" | "fa" | "ur" | "ps" | "yi" => Dir::RTL,
|
||||||
"en" | "fr" | "de" | _ => Dir::LTR,
|
"en" | "fr" | "de" => Dir::LTR,
|
||||||
|
_ => Dir::LTR,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user