lints: carry suppression reasons in #[expect]
Parallax::path had no reader and no stated reason to exist, so it goes
rather than getting an expectation.
Assisted-by: Claude Opus 5.5 via Claude Code
diff --git a/src/parallax.rs b/src/parallax.rs
index 6fd72b9..8c397b0 100644
--- a/src/parallax.rs
+++ b/src/parallax.rs
@@ -1,7 +1,6 @@
#![cfg_attr(test, allow(clippy::expect_used))]
use camino::Utf8Path;
-use camino::Utf8PathBuf;
use mlua::ErrorContext as _;
use mlua::Function;
@@ -80,13 +79,10 @@ fn pop_function(table: &Table, key: &str) -> Result<Option<Function>, mlua::Erro
/// function and flow are handles into the embedded Lua state.
pub struct Parallax {
server: Function,
- // Consumed once running variants lands.
- #[allow(dead_code)]
+ #[expect(dead_code, reason = "run once the browser driver lands")]
flow: Function,
setup: Setup,
name: String,
- #[allow(dead_code)]
- path: Utf8PathBuf,
// The handles above only hold weak references; this is what
// keeps the VM open.
lua: Lua,
@@ -114,7 +110,6 @@ impl Parallax {
flow: config.flow,
setup: config.setup,
name,
- path: path.to_owned(),
lua,
})
}
diff --git a/src/server.rs b/src/server.rs
index 493fa84..d161c5e 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -37,12 +37,16 @@ const TAIL: usize = 2048;
/// `(app)`.
#[derive(Debug, Deserialize)]
pub(crate) struct Handshake {
- // Read once the flow context lands.
- #[allow(dead_code)]
+ #[cfg_attr(
+ not(test),
+ expect(dead_code, reason = "read once the flow context lands")
+ )]
pub(crate) url: String,
- // Read once the flow context lands.
- #[allow(dead_code)]
+ #[cfg_attr(
+ not(test),
+ expect(dead_code, reason = "read once the flow context lands")
+ )]
#[serde(default)]
pub(crate) data: Value,
}
@@ -77,10 +81,15 @@ impl Server {
.map_err(|error| Error::Io(io::Error::other(error)))?
}
- // Read once the flow context lands.
- #[allow(dead_code)]
+ #[cfg_attr(
+ not(test),
+ expect(dead_code, reason = "read once the flow context lands")
+ )]
pub(crate) fn handshake(&self) -> &Handshake {
- #[allow(clippy::expect_used)] // start() only yields a Server once the handshake parsed
+ #[expect(
+ clippy::expect_used,
+ reason = "start() only yields a Server once the handshake parsed"
+ )]
self.handshake
.as_ref()
.expect("a started server has a handshake")
@@ -89,7 +98,10 @@ impl Server {
/// SIGTERM the group, wait out the grace period, then SIGKILL
/// whatever is left — including stragglers a wrapper left behind
/// after its own exit.
- #[allow(clippy::arithmetic_side_effects)] // Instant + Duration only panics near heat death
+ #[expect(
+ clippy::arithmetic_side_effects,
+ reason = "Instant + Duration only panics near heat death"
+ )]
pub(crate) async fn stop(mut self) -> Result<(), Error> {
tokio::task::spawn_blocking(move || {
signal_group(self.pgid, libc::SIGTERM).map_err(Error::Io)?;
@@ -131,15 +143,19 @@ impl Server {
.args(&spec.args)
.env("PARALLAX_HANDSHAKE", &handshake_path)
.stdin(Stdio::null())
- // Stdio conversions need std files; fs_err has no Stdio
- // bridge, and no path-bearing operation happens here.
.stdout({
- #[allow(clippy::disallowed_types)]
+ #[expect(
+ clippy::disallowed_types,
+ reason = "Stdio converts only from std files"
+ )]
let clone: std::fs::File = file.try_clone().map_err(Error::Io)?.into();
Stdio::from(clone)
})
.stderr({
- #[allow(clippy::disallowed_types)]
+ #[expect(
+ clippy::disallowed_types,
+ reason = "Stdio converts only from std files"
+ )]
let log: std::fs::File = file.into();
Stdio::from(log)
})
@@ -211,7 +227,10 @@ enum HandshakeError {
/// unreadable or unparseable — including a missing `url` — keeps
/// waiting until the deadline. `exited` is `Child::try_wait`; the outer
/// error is parallax failing to check, the inner one the app failing.
-#[allow(clippy::arithmetic_side_effects)] // Instant + Duration only panics near heat death
+#[expect(
+ clippy::arithmetic_side_effects,
+ reason = "Instant + Duration only panics near heat death"
+)]
fn wait_for_handshake(
path: &Utf8Path,
timeout: f64,
@@ -253,8 +272,10 @@ fn signal_group(pgid: i32, signal: libc::c_int) -> io::Result<()> {
/// The end of the server's log, cut forward to a line boundary so the
/// quote starts on one.
fn tail(path: &Utf8Path) -> String {
- #[allow(clippy::disallowed_methods)]
- // a log tail is arbitrary bytes headed for an error message
+ #[expect(
+ clippy::disallowed_methods,
+ reason = "a log tail is arbitrary bytes headed for an error message"
+ )]
fn lossy(bytes: &[u8]) -> String {
String::from_utf8_lossy(bytes).into_owned()
}
diff --git a/src/spec.rs b/src/spec.rs
index f0204f9..37d4215 100644
--- a/src/spec.rs
+++ b/src/spec.rs
@@ -61,10 +61,13 @@ pub struct Variant {
/// `flow` out first; a function anywhere else is an error, which is why
/// it deserializes with mlua's default strict options.
#[derive(Debug)]
-#[allow(dead_code)] // baseline and name are read once running lands
pub(crate) struct Setup {
pub(crate) variants: Vec<Variant>,
+ #[cfg_attr(
+ not(test),
+ expect(dead_code, reason = "read once the GitHub task lands")
+ )]
pub(crate) baseline: Option<BaselineSource>,
pub(crate) name: Option<String>,
@@ -138,7 +141,7 @@ impl<'de> Deserialize<'de> for Setup {
/// releases section.
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
-#[allow(dead_code)] // read once the GitHub task lands
+#[expect(dead_code, reason = "read once the GitHub task lands")]
pub(crate) struct BaselineSource {
pub(crate) repo: NonEmptyString,