crates/pf-console-ui/src/screens/controllers.rs built its test Ctx from a closure:
letctx=|platform,settings: &mutSettings|Ctx{…};
A closure cannot be generic over the lifetime in its return type, so the Ctx<'2> it produced could never be tied to the &mut Settings<'1> it borrows:
error: lifetime may not live long enough
--> crates/pf-console-ui/src/screens/controllers.rs:411:55
| returning this value requires that `'1` must outlive `'2`
error: could not compile `pf-console-ui` (lib test)
Nothing platform-specific about it — it just never compiled on any target that builds this crate. It went unnoticed on macOS because pf-console-ui is cfg-gated to linux/windows/android and compiles to an empty lib there.
The fix
A plain fn where the lifetime is written down once — the same helper shape the add_host.rs and library.rs test modules already use:
Targets worktree-release-next-prep, not main — screens/controllers.rs only exists on the release branch, so this is the only base it applies to. Merging it turns #320's clippy leg green.
Unblocks the red clippy leg on #320.
## What broke
`crates/pf-console-ui/src/screens/controllers.rs` built its test `Ctx` from a closure:
```rust
let ctx = |platform, settings: &mut Settings| Ctx { … };
```
A closure cannot be generic over the lifetime in its **return** type, so the `Ctx<'2>` it produced could never be tied to the `&mut Settings<'1>` it borrows:
```
error: lifetime may not live long enough
--> crates/pf-console-ui/src/screens/controllers.rs:411:55
| returning this value requires that `'1` must outlive `'2`
error: could not compile `pf-console-ui` (lib test)
```
Nothing platform-specific about it — it just never compiled on any target that builds this crate. It went unnoticed on macOS because `pf-console-ui` is `cfg`-gated to linux/windows/android and compiles to an empty lib there.
## The fix
A plain `fn` where the lifetime is written down once — the same helper shape the `add_host.rs` and `library.rs` test modules already use:
```rust
fn ctx<'a>(
platform: Platform,
settings: &'a mut Settings,
library: &'a crate::library::LibraryShared,
pads: &'a [PadInfo],
) -> Ctx<'a> { … }
```
One file, +23/−13, test-only. No shipping code touched.
## Checks
All in the `punktfunk-rust-ci` image, since macOS checks nothing here:
- `cargo clippy -p pf-console-ui --all-targets -- -D warnings` — clean (this is the same `lib test` target CI failed on)
- `cargo test -p pf-console-ui` — 185 passed, 0 failed, 1 ignored
- `cargo fmt -p pf-console-ui -- --check` — clean
## Base
Targets `worktree-release-next-prep`, not `main` — `screens/controllers.rs` only exists on the release branch, so this is the only base it applies to. Merging it turns #320's clippy leg green.
enricobuehler
changed target branch from worktree-release-next-prep to main2026-08-19 06:18:25 +00:00
A closure cannot be generic over the lifetime in its return type, so the
`Ctx<'_>` this one built could never be tied to the `&mut Settings` it
borrows — `lifetime may not live long enough`, and the lib test target
failed to compile.
Same shape the add_host and library test modules already use: a plain
`fn ctx<'a>(…) -> Ctx<'a>` where the lifetime is written down once.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Unblocks the red clippy leg on #320.
What broke
crates/pf-console-ui/src/screens/controllers.rsbuilt its testCtxfrom a closure:A closure cannot be generic over the lifetime in its return type, so the
Ctx<'2>it produced could never be tied to the&mut Settings<'1>it borrows:Nothing platform-specific about it — it just never compiled on any target that builds this crate. It went unnoticed on macOS because
pf-console-uiiscfg-gated to linux/windows/android and compiles to an empty lib there.The fix
A plain
fnwhere the lifetime is written down once — the same helper shape theadd_host.rsandlibrary.rstest modules already use:One file, +23/−13, test-only. No shipping code touched.
Checks
All in the
punktfunk-rust-ciimage, since macOS checks nothing here:cargo clippy -p pf-console-ui --all-targets -- -D warnings— clean (this is the samelib testtarget CI failed on)cargo test -p pf-console-ui— 185 passed, 0 failed, 1 ignoredcargo fmt -p pf-console-ui -- --check— cleanBase
Targets
worktree-release-next-prep, notmain—screens/controllers.rsonly exists on the release branch, so this is the only base it applies to. Merging it turns #320's clippy leg green.