Document the match-scrutinee RefCell trap in AGENTS.md

This commit is contained in:
raucao committed 2026-11-24 16:49:36 +04:00
1 parent 834ddcccd5
commit 680ca35a79
1 file changed
+8
+8
View File
@@ -520,6 +520,14 @@ UI lives in `data/resources/ui/*.blp` (Blueprint) and is compiled to `.ui` by
`goto error`). The app then never appears in `Gio.AppInfo::all()`, GNOME Shell
cannot resolve it, and every notification from it is refused — silently. A
desktop file for anything installed outside `PATH` needs an absolute `Exec`.
11. A `match` **scrutinee** is a temporary scope that lasts to the end of the
match, so `match self.cell.borrow().clone() { … None => *self.cell.borrow_mut()
= … }` panics with "RefCell already borrowed" — the `Ref` is still held. Bind
the clone to a local first (`let existing = self.cell.borrow().clone();`) and
match on that. An `if` **condition** is its own temporary scope, so the
`if self.cell.borrow().is_none() { *self.cell.borrow_mut() = … }` form in
`Windows::build` is fine. This bit `present_preferences` on the first click;
the acceptance test now activates `app.preferences` twice over D-Bus for it.
## Blueprint / Meson traps