diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-06-30 11:48:51 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-06-30 11:48:51 +0200 |
| commit | 65c0c5607e56ca8bc7866d94b2496a25e096149a (patch) | |
| tree | 2cb087a9ff524aefa6cff7fc7e1629aaa6bc886b | |
| parent | 470f8001a1dba0022ec9d3e46c67c3bbc31359be (diff) | |
Make clippy a bit happier
| -rw-r--r-- | src/image.rs | 3 | ||||
| -rw-r--r-- | src/layout/incremental.rs | 2 | ||||
| -rw-r--r-- | src/layout/par.rs | 2 | ||||
| -rw-r--r-- | src/layout/shaping.rs | 5 | ||||
| -rw-r--r-- | src/library/text.rs | 3 |
5 files changed, 8 insertions, 7 deletions
diff --git a/src/image.rs b/src/image.rs index 90252ff3..f4617c5a 100644 --- a/src/image.rs +++ b/src/image.rs @@ -54,6 +54,7 @@ impl Debug for Image { } /// Caches decoded images. +#[derive(Default)] pub struct ImageCache { /// Maps from file hashes to ids of decoded images. images: HashMap<ImageId, Image>, @@ -64,7 +65,7 @@ pub struct ImageCache { impl ImageCache { /// Create a new, empty image cache. pub fn new() -> Self { - Self { images: HashMap::new(), on_load: None } + Self::default() } /// Load and decode an image file from a path. diff --git a/src/layout/incremental.rs b/src/layout/incremental.rs index 1dd90f8e..d41fe431 100644 --- a/src/layout/incremental.rs +++ b/src/layout/incremental.rs @@ -21,7 +21,7 @@ pub struct LayoutCache { impl LayoutCache { /// Create a new, empty layout cache. pub fn new() -> Self { - Self { frames: HashMap::new(), age: 0 } + Self::default() } /// Clear the cache. diff --git a/src/layout/par.rs b/src/layout/par.rs index 464853e0..34016737 100644 --- a/src/layout/par.rs +++ b/src/layout/par.rs @@ -285,7 +285,7 @@ fn split_runs<'a>( range: Range, ) -> impl Iterator<Item = (Range, Dir)> + 'a { let mut cursor = range.start; - bidi.levels[range.clone()] + bidi.levels[range] .group_by_key(|&level| level) .map(move |(level, group)| { let start = cursor; diff --git a/src/layout/shaping.rs b/src/layout/shaping.rs index 021e9ecc..2496aae0 100644 --- a/src/layout/shaping.rs +++ b/src/layout/shaping.rs @@ -235,9 +235,8 @@ fn shape_segment<'a>( } } - match ctx.cache.font.select(ctx.loader, family, variant) { - Some(id) => break (id, true), - None => {} + if let Some(id) = ctx.cache.font.select(ctx.loader, family, variant) { + break (id, true); } } // We're out of families, so we don't do any more fallback and just diff --git a/src/library/text.rs b/src/library/text.rs index 28ca2bd8..bf0d49a4 100644 --- a/src/library/text.rs +++ b/src/library/text.rs @@ -204,7 +204,8 @@ pub fn lang(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { fn lang_dir(iso: &str) -> Dir { match iso.to_ascii_lowercase().as_str() { "ar" | "he" | "fa" | "ur" | "ps" | "yi" => Dir::RTL, - "en" | "fr" | "de" | _ => Dir::LTR, + "en" | "fr" | "de" => Dir::LTR, + _ => Dir::LTR, } } |
