anp / moxie

lightweight platform-agnostic tools for declarative UI
https://moxie.rs
Apache License 2.0
828 stars 27 forks source link

Reimplement `mox` with syn_rsx #228

Closed zetanumbers closed 3 years ago

zetanumbers commented 3 years ago

Current implementation of the mox macro uses snax with proc_macro_hack crate. This causes rust-analyzer lining errors. For the reason of snax not being regularly supported i recommend to switch to the syn_rsx crate, which solves these problems and adds linting for the tags and attributes.

anp commented 3 years ago

Thanks! Looks like CI is failing on a few steps.

From the coverage step:

error[E0618]: expected function, found `std::string::String`
  --> dom/tests/custom_component.rs:48:22
   |
46 |           let text = text.unwrap_or_default();
   |               ---- `std::string::String` defined here
47 | 
48 |           let button = mox! {
   |  ______________________^
49 | |             <button onclick={move |_| set_value.update(|n| Some(n + 1))}>
50 | |                 {% "{} ({})", text, value }
51 | |             </button>
52 | |         };
   | |_________^ call expression requires function
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0618]: expected function, found `std::string::String`
  --> dom/tests/custom_component.rs:48:22
   |
46 |           let text = text.unwrap_or_default();
   |               ---- `std::string::String` defined here
47 | 
48 |           let button = mox! {
   |  ______________________^
49 | |             <button onclick={move |_| set_value.update(|n| Some(n + 1))}>
50 | |                 {% "{} ({})", text, value }
51 | |             </button>
52 | |         };
   | |_________^ call expression requires function
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

From clippy:

error[E0618]: expected function, found `std::string::String`
  --> dom/tests/custom_component.rs:48:22
   |
46 |           let text = text.unwrap_or_default();
   |               ---- `std::string::String` defined here
47 | 
48 |           let button = mox! {
   |  ______________________^
49 | |             <button onclick={move |_| set_value.update(|n| Some(n + 1))}>
50 | |                 {% "{} ({})", text, value }
51 | |             </button>
52 | |         };
   | |_________^ call expression requires function
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0618`.
error: could not compile `moxie-dom`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
warning: unnecessary braces around method argument
  --> dom/examples/todo/src/footer.rs:13:21
   |
13 |             <strong>{bolded}</strong>
   |                     ^^^^^^^^ help: remove these braces
   |
   = note: `#[warn(unused_braces)]` on by default

warning: unnecessary braces around method argument
  --> dom/examples/todo/src/lib.rs:30:13
   |
30 |             { main_section() }
   |             ^^^^^^^^^^^^^^^^^^ help: remove these braces

warning: unnecessary braces around method argument
  --> dom/examples/todo/src/lib.rs:29:13
   |
29 |             { input_header() }
   |             ^^^^^^^^^^^^^^^^^^ help: remove these braces

warning: 3 warnings emitted
codecov[bot] commented 3 years ago

Codecov Report

Merging #228 (619236f) into main (4d14a31) will decrease coverage by 0.04%. The diff coverage is 31.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #228      +/-   ##
==========================================
- Coverage   27.78%   27.74%   -0.05%     
==========================================
  Files          50       49       -1     
  Lines       11886    11967      +81     
  Branches     6634     6685      +51     
==========================================
+ Hits         3303     3320      +17     
- Misses       6391     6417      +26     
- Partials     2192     2230      +38     
Impacted Files Coverage Δ
dom/examples/ssr/src/main.rs 36.66% <0.00%> (-0.63%) :arrow_down:
dom/examples/todo/src/filter.rs 0.00% <ø> (ø)
dom/src/lib.rs 0.00% <ø> (ø)
dom/tests/custom_component.rs 0.00% <0.00%> (ø)
dom/examples/todo/src/item.rs 22.24% <25.00%> (ø)
mox/impl/src/lib.rs 36.84% <31.12%> (-10.45%) :arrow_down:
dom/examples/todo/src/input.rs 24.85% <33.33%> (ø)
dom/src/interfaces/node.rs 55.55% <33.33%> (-24.45%) :arrow_down:
mox/tests/derive_builder.rs 55.17% <100.00%> (+7.17%) :arrow_up:
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4d14a31...619236f. Read the comment docs.

anp commented 3 years ago

I'll fix the issue with the publish step shortly.

EDIT: https://github.com/anp/moxie/pull/236