simplify some code

This commit is contained in:
Simon Gardling 2022-03-01 22:00:31 -05:00
parent 9e01b1862c
commit e4b3d9c4a4

View File

@ -375,13 +375,16 @@ impl epi::App for MathApp {
let (back_values, bars) = function.run(); let (back_values, bars) = function.run();
plot_ui.line(back_values.color(Color32::RED)); plot_ui.line(back_values.color(Color32::RED));
area_list.push({
if let Some(bars_data) = bars { if let Some(bars_data) = bars {
let (bar_chart, area) = bars_data; let (bar_chart, area) = bars_data;
plot_ui.bar_chart(bar_chart.color(Color32::BLUE).width(step)); plot_ui
area_list.push(digits_precision(area, 8)) .bar_chart(bar_chart.color(Color32::BLUE).width(step));
digits_precision(area, 8)
} else { } else {
area_list.push(f64::NAN); f64::NAN
} }
});
} }
}); });
}); });