From 98aac84e718001cda1045342afee9547e74b20a7 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 24 Feb 2022 01:13:10 -0500 Subject: [PATCH] rustfmt --- src/chart_manager.rs | 12 +++++------- src/egui_app.rs | 6 ++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/chart_manager.rs b/src/chart_manager.rs index b298553..e75a2c7 100644 --- a/src/chart_manager.rs +++ b/src/chart_manager.rs @@ -56,9 +56,7 @@ impl ChartManager { (filtered_data, rect_data, area) } - pub fn get_step(&self) -> f64 { - (self.max_x - self.min_x).abs() / (self.num_interval as f64) - } + pub fn get_step(&self) -> f64 { (self.max_x - self.min_x).abs() / (self.num_interval as f64) } pub fn do_update_front(&self, resolution: usize, num_interval: usize) -> bool { (self.resolution != resolution) | (num_interval != self.num_interval) @@ -104,7 +102,7 @@ impl ChartManager { // Creates and does the math for creating all the rectangles under the graph #[inline] fn integral_rectangles(&self, step: f64) -> (Vec<(f64, f64)>, f64) { - let half_step = step/2.0; + let half_step = step / 2.0; let data2: Vec<(f64, f64)> = (0..self.num_interval) .map(|e| { let x: f64 = ((e as f64) * step) + self.min_x; @@ -123,12 +121,12 @@ impl ChartManager { true => (x, tmp1), false => (x2, tmp2), }; - + // Applies `half_step` in order to make the bar graph display properly if output.0 > 0.0 { - output.0 = output.0+half_step; + output.0 = output.0 + half_step; } else { - output.0 = output.0-half_step; + output.0 = output.0 - half_step; } output diff --git a/src/egui_app.rs b/src/egui_app.rs index e74f7e7..07f9bfa 100644 --- a/src/egui_app.rs +++ b/src/egui_app.rs @@ -3,7 +3,7 @@ use crate::misc::{digits_precision, test_func, Cache}; use eframe::{egui, epi}; use egui::plot::{Line, Plot, Value, Values}; use egui::widgets::plot::{Bar, BarChart}; -use egui::{Color32}; +use egui::Color32; pub struct MathApp { func_str: String, @@ -134,7 +134,9 @@ impl epi::App for MathApp { } } }; - let bar_chart = BarChart::new(bars).color(Color32::BLUE).width(chart_manager.get_step()); + let bar_chart = BarChart::new(bars) + .color(Color32::BLUE) + .width(chart_manager.get_step()); Plot::new("plot") .view_aspect(1.0)