From 47153d5becdaf47323a811642dab90a95cc3eafc Mon Sep 17 00:00:00 2001 From: ".CooCoo" Date: Mon, 16 Nov 2026 18:37:04 -0800 Subject: [PATCH] linesweeper: the vendored copy passes clippy 1.100.0 with every feature (#1248) --- vendor/linesweeper/README.craft.md | 22 +++++++++++++--------- vendor/linesweeper/SOURCE.json | 7 ++++--- vendor/linesweeper/src/sweep/sweep_line.rs | 3 ++- vendor/linesweeper/src/topology.rs | 5 +++-- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/vendor/linesweeper/README.craft.md b/vendor/linesweeper/README.craft.md index 5c5b4fab1..0ac80967a 100644 --- a/vendor/linesweeper/README.craft.md +++ b/vendor/linesweeper/README.craft.md @@ -1,13 +1,14 @@ # Local linesweeper 0.5.0 copy This is the crates.io linesweeper 0.5.0 package (MIT OR Apache-2.0) with some files left out and the -local patches listed below, to `src/sweep/sweep_line.rs` and `docs/sweep.typ`. `.cargo_vcs_info.json` -names the commit it was packaged from, `824b0791a750f7b27b8edcbb6c6244d0e629875e`. That commit is not -in the GitHub repository the manifest names, which is archived; its README says development moved off -GitHub. +local patches listed below. `.cargo_vcs_info.json` names the commit it was packaged from, +`824b0791a750f7b27b8edcbb6c6244d0e629875e`. That commit is not in the GitHub repository the manifest +names, which is archived; its README says development moved off GitHub. -Every file here except this one, `SOURCE.json` and the two patched files below is byte for byte the -file in the `.crate` archive. `SOURCE.json` records the hash of the `.crate` download +The patched files are `src/sweep/sweep_line.rs`, `src/topology.rs` and `docs/sweep.typ`. + +Every file here except this one, `SOURCE.json` and the patched files below is byte for byte the file +in the `.crate` archive. `SOURCE.json` records the hash of the `.crate` download (`source_archive_sha256`) and, for every file kept, the hash in the package (`source_sha256`) and the hash here (`sha256`). `upstream_repository` is null because no public repository this copy can name holds `upstream_revision`. `local_patches` describes each local patch. @@ -22,6 +23,7 @@ holds `upstream_revision`. `local_patches` describes each local patch. | `docs/sweep.typ` | The intersection scan to the left compares each segment with `alpha^(i+1)` instead of `alpha^i`. With `alpha^i`, its first pass compared `alpha^i` with itself, and the lemma after it is stated for `alpha^(i+1)`. | | `docs/sweep.typ` | Two typos are corrected. "condi0.2tions" reads "conditions", and `q(i+i)` reads `q(i+1)`, the first index for which `q` is false. | | `docs/sweep.typ` | The lemma for the intersection scan to the left asks for the ordering invariant on `(alpha^1, ..., alpha^(i+1))` and the crossing invariant on `(alpha^1, ..., alpha^i)`, which is how the bidirectional lemma uses it. The argument for the order invariant cites the crossing invariant instead of a "third invariant"; the document defines two. | +| `src/sweep/sweep_line.rs`, `src/topology.rs` | Clippy 1.100.0 with `-D warnings` and every feature passes on the library, its unit tests and the `regression` test: the `slow-asserts` invariant check in `sweep_line.rs` passes `self.line` to `assert!` without a `&` (`useless_borrows_in_formatting`), and `Contours::grouped` iterates over the contours with `enumerate` instead of indexing them (`needless_range_loop`). The behavior does not change. Code comments label the change `Craft patch (clippy lints)`. | `omitted_files` lists the 43 files of the package left out here, with their hashes: @@ -49,13 +51,15 @@ linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "" } ## Tests `scripts/test-pdf-backends.sh` runs the package's unit, regression and doc tests. The `craft-prepress` -tests with the `flatten` feature run against this copy. `pdf.yml`'s path filter does not list this -directory, so a pull request that changes only files here does not start `pdf.yml`. Run the tests from -this directory: +tests with the `flatten` feature run against this copy. `pdf.yml`'s path filter lists this directory, +so a pull request that changes files here starts `pdf.yml`. No workflow runs clippy on this copy. Run +the tests and clippy from this directory: ```sh cargo test --locked --lib --test regression cargo test --locked --doc +cargo clippy --locked --all-features --lib --test regression -- -D warnings +cargo clippy --locked --all-features --lib --profile test -- -D warnings ``` `Cargo.toml` leaves out the `kompari`, `linesweeper_util` and `path-bool` dev-dependencies, which diff --git a/vendor/linesweeper/SOURCE.json b/vendor/linesweeper/SOURCE.json index e08bebf3e..fa67075db 100644 --- a/vendor/linesweeper/SOURCE.json +++ b/vendor/linesweeper/SOURCE.json @@ -12,7 +12,8 @@ "In `src/curve/mod.rs`, when the chord that `fit_quadratic` takes for a very short curve gives a constant term that is not finite, `fit_quadratic` takes the line through the curve's start point with the chord's slope, so a curve near x = 1e305 with heights near 1e4 no longer gives a NaN coefficient. In `src/curve/line.rs`, `line_at_ys` scales the x coordinates by 2^600 before the weighted sum and back after it when both have a magnitude below 2^-500, so a subnormal x coordinate no longer rounds to 0. Both files add tests for it.", "In `docs/sweep.typ`, the intersection scan to the left compares each segment with `alpha^(i+1)`, the segment the lemma after it is stated for, instead of `alpha^i`.", "In `docs/sweep.typ`, the typo \"condi0.2tions\" reads \"conditions\", and `q(i+i)` reads `q(i+1)`, the first index for which `q` is false.", - "In `docs/sweep.typ`, the lemma for the intersection scan to the left asks for the ordering invariant on `(alpha^1, ..., alpha^(i+1))` and the crossing invariant on `(alpha^1, ..., alpha^i)`, as the bidirectional lemma uses it, and the argument for the order invariant cites the crossing invariant instead of a \"third invariant\"." + "In `docs/sweep.typ`, the lemma for the intersection scan to the left asks for the ordering invariant on `(alpha^1, ..., alpha^(i+1))` and the crossing invariant on `(alpha^1, ..., alpha^i)`, as the bidirectional lemma uses it, and the argument for the order invariant cites the crossing invariant instead of a \"third invariant\".", + "In `src/sweep/sweep_line.rs` and `src/topology.rs`, two changes make clippy 1.100.0 with `-D warnings` and every feature pass on the library, its unit tests and the `regression` test: the `slow-asserts` invariant check passes `self.line` to `assert!` without a `&`, and `Contours::grouped` iterates over the contours with `enumerate` instead of indexing them. The behavior does not change." ], "files": [ { "path": ".cargo_vcs_info.json", "source_sha256": "47fba6a9dbdf445a5c97f783c9be62093035f9d5e5cdc2cf3216ad8259bcd8fc", "source_git_blob": null, "sha256": "47fba6a9dbdf445a5c97f783c9be62093035f9d5e5cdc2cf3216ad8259bcd8fc" }, @@ -68,8 +69,8 @@ { "path": "src/sweep/snapshots/linesweeper__sweep__sweep_line__tests__square.snap", "source_sha256": "b35c3e6a38d5ecdd8acf315ba0b0bd6485cd8b40193fdd76bd446bdfdb6eda77", "source_git_blob": null, "sha256": "b35c3e6a38d5ecdd8acf315ba0b0bd6485cd8b40193fdd76bd446bdfdb6eda77" }, { "path": "src/sweep/snapshots/linesweeper__sweep__sweep_line__tests__square_and_diamond.snap", "source_sha256": "3f01a76fb7ff4aef0fd55fd869602d4a2b69fff1bd65632f406b275b5d6af600", "source_git_blob": null, "sha256": "3f01a76fb7ff4aef0fd55fd869602d4a2b69fff1bd65632f406b275b5d6af600" }, { "path": "src/sweep/snapshots/linesweeper__sweep__sweep_line__tests__two_squares.snap", "source_sha256": "79e3c95e563a66c0ce244125470a106a18dfe29f276b732defd305406c873c7e", "source_git_blob": null, "sha256": "79e3c95e563a66c0ce244125470a106a18dfe29f276b732defd305406c873c7e" }, - { "path": "src/sweep/sweep_line.rs", "source_sha256": "822b261f682911ea0c0370eaf17d9201a1e639b315359dcb6a3b877a229816e3", "source_git_blob": null, "sha256": "b8569de346ffe8f35f9b56a3e3621ed0910c5a572c58b3184fe2810d6c82a416" }, - { "path": "src/topology.rs", "source_sha256": "9c9b48bc3853884425127e2d64e8ed957ba0d27e1696e2c457e95282e52d6a5b", "source_git_blob": null, "sha256": "9c9b48bc3853884425127e2d64e8ed957ba0d27e1696e2c457e95282e52d6a5b" }, + { "path": "src/sweep/sweep_line.rs", "source_sha256": "822b261f682911ea0c0370eaf17d9201a1e639b315359dcb6a3b877a229816e3", "source_git_blob": null, "sha256": "44a585c1feb525b6616c6ee4b82c6d12d7de597e7d9287a44c1075417afb270a" }, + { "path": "src/topology.rs", "source_sha256": "9c9b48bc3853884425127e2d64e8ed957ba0d27e1696e2c457e95282e52d6a5b", "source_git_blob": null, "sha256": "8729c2dd5941668f3d2805b6562d2d144d4e5156836b894b887394d9d2961aa7" }, { "path": "src/treevec.rs", "source_sha256": "d88b9fbf02fa9f318560e1d483d465555f2b696ae12c00f8e4f5b71ea6779445", "source_git_blob": null, "sha256": "d88b9fbf02fa9f318560e1d483d465555f2b696ae12c00f8e4f5b71ea6779445" }, { "path": "src/typed_vec.rs", "source_sha256": "3e9a2675b8a40d8fc4df0575bd9d0d16b5604d18e9b78638dd5a612b28fc4c30", "source_git_blob": null, "sha256": "3e9a2675b8a40d8fc4df0575bd9d0d16b5604d18e9b78638dd5a612b28fc4c30" }, { "path": "tests/fonts.rs", "source_sha256": "081604ebf560a19ff0427efd9a17eaaa0a3b46ad0bf58323fd6e21b6c0764400", "source_git_blob": null, "sha256": "081604ebf560a19ff0427efd9a17eaaa0a3b46ad0bf58323fd6e21b6c0764400" }, diff --git a/vendor/linesweeper/src/sweep/sweep_line.rs b/vendor/linesweeper/src/sweep/sweep_line.rs index 57de1bc73..41e07d88c 100644 --- a/vendor/linesweeper/src/sweep/sweep_line.rs +++ b/vendor/linesweeper/src/sweep/sweep_line.rs @@ -972,7 +972,8 @@ impl<'segs> Sweeper<'segs> { y_int, self.y, self.events.intersection, - &self.line, + // Craft patch (clippy lints): the format arguments are taken by reference already. + self.line, ); } } diff --git a/vendor/linesweeper/src/topology.rs b/vendor/linesweeper/src/topology.rs index 8420d015a..10a892733 100644 --- a/vendor/linesweeper/src/topology.rs +++ b/vendor/linesweeper/src/topology.rs @@ -2194,8 +2194,9 @@ impl Contours { pub fn grouped(&self) -> Vec> { let mut children = vec![Vec::new(); self.contours.len()]; let mut top_level = Vec::new(); - for i in 0..self.contours.len() { - if let Some(parent) = self.contours[i].parent { + // Craft patch (clippy lints): iterate over the contours instead of indexing them. + for (i, contour) in self.contours.iter().enumerate() { + if let Some(parent) = contour.parent { children[parent.0].push(ContourIdx(i)); } else { top_level.push(ContourIdx(i));