diff options
| author | Laurenz <laurmaedje@gmail.com> | 2025-07-05 14:23:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-05 12:23:48 +0000 |
| commit | d1deb80bb8b4d5fad348c23a3e079e4854aa57e4 (patch) | |
| tree | 364ce69e49966aa7fd0077fb8aaaa70cea1f8ae5 /crates/typst-library/src/layout | |
| parent | 88e451b3dc5c23f52d4fe69d1c6abb4ca9463b1a (diff) | |
Fix nightly warnings (#6558)
Diffstat (limited to 'crates/typst-library/src/layout')
| -rw-r--r-- | crates/typst-library/src/layout/container.rs | 16 | ||||
| -rw-r--r-- | crates/typst-library/src/layout/fragment.rs | 4 |
2 files changed, 17 insertions, 3 deletions
diff --git a/crates/typst-library/src/layout/container.rs b/crates/typst-library/src/layout/container.rs index 725f177b..fc27644e 100644 --- a/crates/typst-library/src/layout/container.rs +++ b/crates/typst-library/src/layout/container.rs @@ -497,7 +497,8 @@ mod callbacks { macro_rules! callback { ($name:ident = ($($param:ident: $param_ty:ty),* $(,)?) -> $ret:ty) => { - #[derive(Debug, Clone, PartialEq, Hash)] + #[derive(Debug, Clone, Hash)] + #[allow(clippy::derived_hash_with_manual_eq)] pub struct $name { captured: Content, f: fn(&Content, $($param_ty),*) -> $ret, @@ -535,6 +536,19 @@ mod callbacks { (self.f)(&self.captured, $($param),*) } } + + impl PartialEq for $name { + fn eq(&self, other: &Self) -> bool { + // Comparing function pointers is problematic. Since for + // each type of content, there is typically just one + // callback, we skip it. It barely matters anyway since + // getting into a comparison codepath for inline & block + // elements containing callback bodies is close to + // impossible (as these are generally generated in show + // rules). + self.captured.eq(&other.captured) + } + } }; } diff --git a/crates/typst-library/src/layout/fragment.rs b/crates/typst-library/src/layout/fragment.rs index c2666115..dd28191c 100644 --- a/crates/typst-library/src/layout/fragment.rs +++ b/crates/typst-library/src/layout/fragment.rs @@ -47,12 +47,12 @@ impl Fragment { } /// Iterate over the contained frames. - pub fn iter(&self) -> std::slice::Iter<Frame> { + pub fn iter(&self) -> std::slice::Iter<'_, Frame> { self.0.iter() } /// Iterate over the contained frames. - pub fn iter_mut(&mut self) -> std::slice::IterMut<Frame> { + pub fn iter_mut(&mut self) -> std::slice::IterMut<'_, Frame> { self.0.iter_mut() } } |
