Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into dom-bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldSEnder committed Mar 5, 2022
2 parents c1a7ba9 + 221b4df commit 0678829
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/boids/src/slider.rs
Expand Up @@ -54,7 +54,7 @@ impl Component for Slider {
step,
} = *ctx.props();

let precision = precision.unwrap_or_else(|| if percentage { 1 } else { 0 });
let precision = precision.unwrap_or(if percentage { 1 } else { 0 });

let display_value = if percentage {
format!("{:.p$}%", 100.0 * value, p = precision)
Expand Down
17 changes: 3 additions & 14 deletions examples/futures/src/markdown.rs
Expand Up @@ -53,18 +53,12 @@ pub fn render_markdown(src: &str) -> Html {
pre.add_child(top.into());
top = pre;
} else if let Tag::Table(aligns) = tag {
for r in top
.children_mut()
.iter_mut()
.map(|ch| ch.iter_mut())
.flatten()
{
for r in top.children_mut().iter_mut().flat_map(|ch| ch.iter_mut()) {
if let VNode::VTag(ref mut vtag) = r {
for (i, c) in vtag
.children_mut()
.iter_mut()
.map(|ch| ch.iter_mut())
.flatten()
.flat_map(|ch| ch.iter_mut())
.enumerate()
{
if let VNode::VTag(ref mut vtag) = c {
Expand All @@ -79,12 +73,7 @@ pub fn render_markdown(src: &str) -> Html {
}
}
} else if let Tag::TableHead = tag {
for c in top
.children_mut()
.iter_mut()
.map(|ch| ch.iter_mut())
.flatten()
{
for c in top.children_mut().iter_mut().flat_map(|ch| ch.iter_mut()) {
if let VNode::VTag(ref mut vtag) = c {
// TODO
// vtag.tag = "th".into();
Expand Down
12 changes: 4 additions & 8 deletions packages/yew/src/dom_bundle/btag/listeners.rs
Expand Up @@ -243,8 +243,7 @@ impl Registry {
fn handle(desc: EventDescriptor, event: Event) {
let target = match event
.target()
.map(|el| el.dyn_into::<web_sys::Element>().ok())
.flatten()
.and_then(|el| el.dyn_into::<web_sys::Element>().ok())
{
Some(el) => el,
None => return,
Expand All @@ -257,18 +256,15 @@ impl Registry {
let run_handler = |el: &web_sys::Element| {
if let Some(l) = LISTENER_ID_PROP
.with(|prop| js_sys::Reflect::get(el, prop).ok())
.map(|v| v.dyn_into().ok())
.flatten()
.map(|num: js_sys::Number| {
.and_then(|v| v.dyn_into().ok())
.and_then(|num: js_sys::Number| {
Registry::with(|r| {
r.by_id
.get(&(num.value_of() as u32))
.map(|s| s.get(&desc))
.flatten()
.and_then(|s| s.get(&desc))
.cloned()
})
})
.flatten()
{
for l in l {
l.handle(event.clone());
Expand Down
2 changes: 1 addition & 1 deletion tools/process-benchmark-results/src/main.rs
Expand Up @@ -20,7 +20,7 @@ fn main() -> Result<()> {
let transformed_benchmarks: Vec<GhActionBenchmark> = input_json
.into_iter()
.map(|v| GhActionBenchmark {
name: format!("{} {}", v["framework"], v["benchmark"]).replace("\"", ""),
name: format!("{} {}", v["framework"], v["benchmark"]).replace('\"', ""),
unit: String::default(),
value: v["median"].to_string(),
})
Expand Down
2 changes: 1 addition & 1 deletion tools/website-test/build.rs
Expand Up @@ -86,7 +86,7 @@ impl Level {
.unwrap()
.to_str()
.unwrap()
.replace("-", "_");
.replace('-', "_");

self.write_space(dst, level);

Expand Down

1 comment on commit 0678829

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yew master branch benchmarks (Lower is better)

Benchmark suite Current: 0678829 Previous: 221b4df Ratio
yew-struct-keyed 01_run1k 241.9545 229.158 1.06
yew-struct-keyed 02_replace1k 246.429 259.659 0.95
yew-struct-keyed 03_update10th1k_x16 362.802 442.261 0.82
yew-struct-keyed 04_select1k 73.0215 85.5575 0.85
yew-struct-keyed 05_swap1k 93.424 95.543 0.98
yew-struct-keyed 06_remove-one-1k 29.796 32.479 0.92
yew-struct-keyed 07_create10k 2606.4044999999996 2780.947 0.94
yew-struct-keyed 08_create1k-after1k_x2 502.9775 521.0815 0.97
yew-struct-keyed 09_clear1k_x8 263.874 268.7265 0.98
yew-struct-keyed 21_ready-memory 0.9634475708007812 0.9634475708007812 1
yew-struct-keyed 22_run-memory 1.5037879943847656 1.4966659545898438 1.00
yew-struct-keyed 23_update5-memory 1.4616203308105469 1.5060157775878906 0.97
yew-struct-keyed 24_run5-memory 1.5111770629882812 1.5109291076660156 1.00
yew-struct-keyed 25_run-clear-memory 1.128643035888672 1.1288795471191406 1.00
yew-struct-keyed 31_startup-ci 1808.6985 1787.7325 1.01
yew-struct-keyed 32_startup-bt 33.35799999999999 35.86199999999999 0.93
yew-struct-keyed 34_startup-totalbytes 359.8974609375 359.8974609375 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.