fix(vdisplay/windows): Windows clippy — per-block SAFETY comments + then_some
apple / swift (push) Successful in 1m10s
android / android (push) Successful in 4m38s
ci / rust (push) Failing after 30s
arch / build-publish (push) Successful in 5m25s
ci / web (push) Successful in 49s
ci / docs-site (push) Successful in 59s
apple / screenshots (push) Successful in 5m37s
windows-host / package (push) Successful in 7m54s
deb / build-publish (push) Successful in 3m1s
decky / build-publish (push) Successful in 14s
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Successful in 5s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 4s
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 4s
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 6s
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 4s
ci / bench (push) Successful in 5m34s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 10m16s
docker / deploy-docs (push) Successful in 18s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 10m6s
apple / swift (push) Successful in 1m10s
android / android (push) Successful in 4m38s
ci / rust (push) Failing after 30s
arch / build-publish (push) Successful in 5m25s
ci / web (push) Successful in 49s
ci / docs-site (push) Successful in 59s
apple / screenshots (push) Successful in 5m37s
windows-host / package (push) Successful in 7m54s
deb / build-publish (push) Successful in 3m1s
decky / build-publish (push) Successful in 14s
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Successful in 5s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 4s
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 4s
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 6s
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 4s
ci / bench (push) Successful in 5m34s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 10m16s
docker / deploy-docs (push) Successful in 18s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 10m6s
The branch's Windows-host code never ran through the fleet Windows clippy (kept off CI); the merge to main exposed it. Fix the 4 -D warnings failures in cfg(windows) code: - manager.rs: 3 unsafe blocks (isolate_displays_ccd / force_extend_topology / set_virtual_primary_ccd) had one "both arms" SAFETY comment on the `match` line — clippy::undocumented_unsafe_blocks wants it immediately before each block. Split into per-block SAFETY comments. - win_display.rs: `.then(|| …)` on a POD u32 union read → `.then_some(…)` (eager is fine, discarded when false) for clippy::unnecessary_lazy_evaluations. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -655,10 +655,10 @@ impl VirtualDisplayManager {
|
||||
// MODE_CHANGE storm). Opt out (extend) with PUNKTFUNK_NO_ISOLATE=1 / the console policy.
|
||||
use crate::vdisplay::policy::Topology;
|
||||
match topology_action() {
|
||||
// SAFETY (both arms): the CCD helper is `unsafe` for its topology FFI; it takes a
|
||||
// `Copy` `u32` by value and returns an owned `SavedConfig` (no borrowed memory crosses),
|
||||
// and runs under the `state` lock, the sole mutator of the topology.
|
||||
Topology::Exclusive => {
|
||||
// SAFETY: `isolate_displays_ccd` is `unsafe` for its CCD topology FFI; it takes the
|
||||
// `Copy` target id by value and returns an owned `SavedConfig` (no borrowed memory
|
||||
// crosses), under the `state` lock — the sole topology mutator.
|
||||
ccd_saved = unsafe { isolate_displays_ccd(added.target_id) };
|
||||
}
|
||||
Topology::Primary => {
|
||||
@@ -668,8 +668,12 @@ impl VirtualDisplayManager {
|
||||
// alongside the virtual, THEN reposition to make the virtual primary — so the
|
||||
// physical stays active. (The bring-up above only force-EXTENDs when the
|
||||
// virtual FAILS to auto-resolve; here it resolved, so we do it explicitly.)
|
||||
// SAFETY: `force_extend_topology` drives the CCD topology FFI (no args, no borrowed
|
||||
// memory), under the `state` lock — the sole topology mutator.
|
||||
unsafe { force_extend_topology() };
|
||||
thread::sleep(Duration::from_millis(300));
|
||||
// SAFETY: `set_virtual_primary_ccd` takes the `Copy` target id by value and returns
|
||||
// an owned `SavedConfig` (no borrowed memory crosses), under the `state` lock.
|
||||
ccd_saved = unsafe { set_virtual_primary_ccd(added.target_id) };
|
||||
}
|
||||
Topology::Extend | Topology::Auto => {
|
||||
|
||||
@@ -492,8 +492,10 @@ pub(crate) unsafe fn set_virtual_primary_ccd(keep_target_id: u32) -> Option<Save
|
||||
}
|
||||
let idx = p.sourceInfo.Anonymous.modeInfoIdx as usize;
|
||||
let m = modes.get(idx)?;
|
||||
// `then_some` (eager): `sourceMode.width` is a POD `u32` union read, discarded when the arm is
|
||||
// false — no lazy guard needed. (`then(|| …)` here trips clippy::unnecessary_lazy_evaluations.)
|
||||
(m.infoType == DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE)
|
||||
.then(|| m.Anonymous.sourceMode.width as i32)
|
||||
.then_some(m.Anonymous.sourceMode.width as i32)
|
||||
})?;
|
||||
let others = paths.len().saturating_sub(1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user