Skip to content

fix(macro): repair efx_ctx! argument parsing; add AGENTS.md - #43

Open
ZhukMax wants to merge 3 commits into
v0.7from
fix/efx-ctx-input
Open

ZhukMax wants to merge 3 commits into
v0.7from
fix/efx-ctx-input

Conversation

@ZhukMax

@ZhukMax ZhukMax commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

What

1. efx_ctx! was broken on v0.7 (efx/src/input.rs)
EfxCtxInput::parse consumed the comma between ctx and the template, then the struct literal's _comma: input.parse()? tried to read a second comma after the template. Every efx_ctx!(ctx, "...") call failed with expected `,` — efx-sandbox did not compile on v0.7. Fix: drop the _comma field.

2. Failing trybuild case tests/ui/unknown_tag.rs
Since unknown tags now go through the .efx component lookup, the error text had changed. The message now explains the lookup and stays machine-independent (no absolute paths):

efx: unknown tag <WAT>: not a built-in tag, and no component file `WAT.efx` found in `$EFX_UI_PATH` or `src/ui/`

.stderr re-blessed with TRYBUILD=overwrite.

3. Regression tests

  • efx/tests/ctx_ok.rs — renders Window, TopPanel, CentralPanel via efx_ctx! against a real egui::Context (inside ctx.run), plus a call with an expression ctx (&app.ctx). Verified it fails without the fix.
  • efx/tests/ui/ctx_non_root.rs — compile error when the root is not a context-root tag.

4. Housekeeping — rustfmt on efx-core/src/component.rs and a collapsed nested if (clippy collapsible_if); it was the first clippy error and hid the rest.

5. AGENTS.md (separate commit) — guide for AI agents and contributors: codegen architecture, commands and CI state, branch policy, tag checklist, syntax as actually implemented, verified known issues, roadmap, and a promotion section with a dated baseline.

6. Clippy-clean v0.7 (third commit)

  • Library: removed never-read element fields (+ their clones) from Image, Table, Tabs, DataTable; data_table.rs lints (question_mark, needless_borrow, useless_conversion, let_and_return).
  • Generated code no longer triggers lints in the user's crate — these fired on every call site, so anyone running clippy -D warnings on an app using EFx hit them:
    • trailing () in Window / CentralPanel / TopPanel / BottomPanel / SidePanel and efx_ctx! expansions → clippy::unused_unit;
    • Button / Image rounding emitted deprecated egui::Rounding / .rounding() → now corner_radius(CornerRadius::same(..));
    • non-root <Button> / <Hyperlink> left a #[must_use] Response unused → now let _ = ….
  • New test: efx_ctx! evaluates to () for all five context roots (guards the () removal).
  • efx-sandbox: counter field is now displayed (was dead code). Changelog entries under 0.7.

Verification (rustc/clippy 1.99.1)

  • cargo test --all-targets --all-features — green (same as test.yml), incl. trybuild and doctests
  • cargo clippy --all-targets --all-features -- -D warnings — green (same as clippy.yml); also green without --all-features
  • cargo fmt --all -- --check — clean
  • cargo build -p efx --examples, cargo build -p efx-sandbox — build
  • A throwaway example using Button (plain + styled), Hyperlink (both modes), TextField, Window open= passed clippy -D warnings

Reviewer notes

  • Targets v0.7 (not main) per CONTRIBUTING.md; against main this would drag in all unreleased 0.7 commits.
  • <Hyperlink> returns Response only in "advanced" mode; in simple mode it evaluates to (). Pre-existing, left as is, noted in AGENTS.md.
  • wasm32 build of eframe_demo not run locally — CI covers it.

🤖 Generated with Claude Code

Максим Жук and others added 3 commits November 9, 2026 11:40
EfxCtxInput::parse consumed the comma between ctx and template, then
tried to parse a second comma after the template, so every efx_ctx!
call failed with "expected `,`" (efx-sandbox did not compile).

- Drop the extra `_comma` field from EfxCtxInput.
- Make the unknown-tag error explain the component file lookup and
  re-bless tests/ui/unknown_tag.stderr.
- Add tests/ctx_ok.rs (renders Window/TopPanel/CentralPanel through
  efx_ctx! against a real egui::Context) and tests/ui/ctx_non_root.rs.
- rustfmt efx-core/src/component.rs and collapse a nested `if`
  flagged by clippy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Guide for AI agents and contributors: architecture of the efx! codegen,
commands and current CI state, branch policy, tag checklist, syntax as
actually implemented, verified known issues, roadmap milestones, and a
promotion section with a dated baseline, positioning and posting rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Library lints (clippy --all-targets --all-features -D warnings):
- Remove never-read `element` fields (and their clones) from Image,
  Table, Tabs and DataTable; children are already parsed into
  rows/tabs/cells.
- data_table.rs: `?` instead of match-return, drop needless borrow,
  useless `.into()` and let-and-return.

Generated code no longer triggers lints in the caller's crate:
- Drop the trailing `()` from Window/CentralPanel/TopPanel/
  BottomPanel/SidePanel and efx_ctx! expansions (clippy unused_unit
  fired on every call).
- Button/Image `rounding` now emit `corner_radius(CornerRadius::same)`
  instead of the deprecated `rounding(Rounding::same)` (egui 0.33).
- Non-root <Button>/<Hyperlink> discard their Response with `let _ =`
  (unused #[must_use] warning).

Also: show `counter` in efx-sandbox (dead field), add a test that
efx_ctx! evaluates to `()` for all five context roots, Changelog
entries, AGENTS.md updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant