Gate the crates.io publish on clippy and tests
The publish recipe's prebuild step now runs clippy -D warnings alongside the
test suite it already ran.
Two lints stood in the way. The OKLab matrix coefficients keep their published
precision behind an allow, since f32 rounds them at compile time and truncating
the literals would only make them harder to diff against the reference. The
resolve() doc comment gains a blank line so its trailing paragraph stops
reading as a continuation of list item 2.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2 files changed,
+15 insertions,
-2 deletions
| 16 |
16 |
|
step("checkout");
|
| 17 |
17 |
|
sh_ok(h, "cd " + r + " && git pull --ff-only");
|
| 18 |
18 |
|
|
| 19 |
|
- |
step("build");
|
| 20 |
|
- |
sh_ok(h, "cd " + r + " && cargo test " + feature_flags());
|
|
19 |
+ |
// Gate: nothing reaches crates.io from code that fails clippy or its tests. A
|
|
20 |
+ |
// published version can be yanked but never edited, so this is the last point
|
|
21 |
+ |
// at which a break is still cheap.
|
|
22 |
+ |
step("prebuild");
|
|
23 |
+ |
sh_ok(h, "cd " + r + " && cargo clippy --workspace --all-targets " + feature_flags() + " -- -D warnings");
|
|
24 |
+ |
sh_ok(h, "cd " + r + " && cargo test --workspace " + feature_flags());
|
| 21 |
25 |
|
|
| 22 |
26 |
|
step("verify");
|
| 23 |
27 |
|
// Credentials are checked here too, and deliberately not passed through Bento:
|
| 136 |
136 |
|
|
| 137 |
137 |
|
impl Rgb {
|
| 138 |
138 |
|
/// Convert to OKLab (Ottosson's sRGB matrices).
|
|
139 |
+ |
///
|
|
140 |
+ |
/// The matrix coefficients are quoted at their published precision so they
|
|
141 |
+ |
/// can be diffed against the reference. `f32` rounds them at compile time;
|
|
142 |
+ |
/// truncating the literals would only make them harder to check.
|
|
143 |
+ |
#[allow(clippy::excessive_precision)]
|
| 139 |
144 |
|
pub fn to_oklab(self) -> Oklab {
|
| 140 |
145 |
|
let (r, g, b) = (
|
| 141 |
146 |
|
srgb_to_linear(self.r),
|
| 154 |
159 |
|
}
|
| 155 |
160 |
|
|
| 156 |
161 |
|
/// Convert from OKLab back to the nearest in-gamut sRGB.
|
|
162 |
+ |
///
|
|
163 |
+ |
/// Published precision, as in [`Rgb::to_oklab`].
|
|
164 |
+ |
#[allow(clippy::excessive_precision)]
|
| 157 |
165 |
|
pub fn from_oklab(c: Oklab) -> Rgb {
|
| 158 |
166 |
|
let l_ = c.l + 0.3963377774 * c.a + 0.2158037573 * c.b;
|
| 159 |
167 |
|
let m_ = c.l - 0.1055613458 * c.a - 0.0638541728 * c.b;
|
| 458 |
466 |
|
/// 1. Copy each present base intent from the authored colors.
|
| 459 |
467 |
|
/// 2. Compute the derived interactive states from the base intents, using the
|
| 460 |
468 |
|
/// same math the apps used to apply individually (so output is identical).
|
|
469 |
+ |
///
|
| 461 |
470 |
|
/// Each derived token is emitted only when its source intents exist, mirroring
|
| 462 |
471 |
|
/// the skip-missing behavior of the rest of the crate.
|
| 463 |
472 |
|
pub fn resolve(theme: &ThemeColors) -> SemanticTokens {
|