M2: format the page-box lines of hayro-syntax patch 38 as default rustfmt does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCHD1R3rywQBPCHXZA
This commit is contained in:
mtlcl410andClaude Opus 5.5 committed 2026-11-08 00:28:45 +08:00
1 parent 879999e12b
commit 1bb42aaacf
2 files changed
+53 -3

No files matched your search

+39
View File
@@ -168,6 +168,7 @@ dependencies = [
"rustc-hash",
"sha2",
"smallvec",
"stringprep",
"zune-jpeg",
]
@@ -244,12 +245,50 @@ version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "stringprep"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1"
dependencies = [
"unicode-bidi",
"unicode-normalization",
"unicode-properties",
]
[[package]]
name = "tinyvec"
version = "1.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
[[package]]
name = "typenum"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
[[package]]
name = "unicode-bidi"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"
[[package]]
name = "unicode-normalization"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75cd3fb03d5288b3ba9a1ee103ac7e9cbb59f0b03d64f8ddfcc04dd42758a85d"
dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-properties"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "993ad287eb20e8ba755312801cfe1413e0f25d604075863acaddca10b04c1833"
[[package]]
name = "version_check"
version = "0.9.5"
+14 -3
View File
@@ -411,14 +411,20 @@ impl<'a> Page<'a> {
// A page's own box without area gives way to one it inherits that has some. Each box
// set aside is logged, as other repairs of this reader are.
let own_media = dict.get::<Rect>(MEDIA_BOX);
let media_box = own_media.filter(has_area).or(ctx.media_box.filter(has_area)).unwrap_or(A4);
let media_box = own_media
.filter(has_area)
.or(ctx.media_box.filter(has_area))
.unwrap_or(A4);
if own_media.or(ctx.media_box).is_some_and(|m| !has_area(&m)) {
warn!("a /MediaBox without area was read as missing");
}
let shows = |c: &Rect| has_area(&c.intersect(media_box));
let own_crop = dict.get::<Rect>(CROP_BOX);
let crop_box = own_crop.filter(shows).or(ctx.crop_box.filter(shows)).unwrap_or(media_box);
let crop_box = own_crop
.filter(shows)
.or(ctx.crop_box.filter(shows))
.unwrap_or(media_box);
if own_crop.or(ctx.crop_box).is_some_and(|c| !shows(&c)) {
warn!("a /CropBox with no area in the media box was read as missing");
}
@@ -815,7 +821,12 @@ const POINTS_PER_MM: f64 = 1.0 / (10.0 * 2.54) * POINTS_PER_INCH;
/// nothing.
fn has_area(r: &Rect) -> bool {
let (w, h) = (r.width() as f32, r.height() as f32);
w.is_finite() && h.is_finite() && w > 0.0 && h > 0.0 && !w.is_nearly_zero() && !h.is_nearly_zero()
w.is_finite()
&& h.is_finite()
&& w > 0.0
&& h > 0.0
&& !w.is_nearly_zero()
&& !h.is_nearly_zero()
}
/// The dimension of an A4 page.