From 79457ad168ce6a9e535954e403a281d6023f4a9c Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Wed, 23 Feb 2022 15:38:07 -0500 Subject: [PATCH] clippy --- src/egui_app.rs | 23 +++++++++++------------ src/lib.rs | 2 +- src/misc.rs | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/egui_app.rs b/src/egui_app.rs index edb6d65..9a2b534 100644 --- a/src/egui_app.rs +++ b/src/egui_app.rs @@ -1,17 +1,16 @@ -use core::num; + use crate::chart_manager::ChartManager; -use crate::misc::{add_asterisks, digits_precision, test_func, Cache, Function}; +use crate::misc::{digits_precision, test_func}; use eframe::{egui, epi}; use egui::widgets::plot::{Bar, BarChart}; use egui::{ - plot::{HLine, Line, Plot, Text, Value, Values}, - Pos2, + plot::{Line, Plot, Value, Values}, }; -use egui::{Color32, ColorImage, Ui}; -use emath::Rect; -use epaint::{RectShape, Rounding, Stroke}; -use meval::Expr; +use egui::{Color32}; + + + pub struct MathApp { func_str: String, @@ -46,13 +45,13 @@ impl epi::App for MathApp { /// Called each time the UI needs repainting, which may be many times per second. /// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`. - fn update(&mut self, ctx: &egui::Context, frame: &epi::Frame) { + fn update(&mut self, ctx: &egui::Context, _frame: &epi::Frame) { let Self { func_str, min_x, max_x, num_interval, - resolution, + resolution: _, chart_manager, } = self; @@ -65,7 +64,7 @@ impl epi::App for MathApp { ui.text_edit_singleline(func_str); }); let func_test_output = test_func(func_str.clone()); - if func_test_output != "" { + if !func_test_output.is_empty() { parse_error = func_test_output; } @@ -76,7 +75,7 @@ impl epi::App for MathApp { }); egui::CentralPanel::default().show(ctx, |ui| { - if parse_error != "" { + if !parse_error.is_empty() { ui.label(format!("Error: {}", parse_error)); return; } diff --git a/src/lib.rs b/src/lib.rs index 921d143..fec3bf2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ mod chart_manager; mod egui_app; mod misc; -use std::panic; + #[cfg(target_arch = "wasm32")] use eframe::{egui, epi}; diff --git a/src/misc.rs b/src/misc.rs index 18990ca..aa68e43 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -109,7 +109,7 @@ pub fn test_func(function_string: String) -> String { // Rounds f64 to specific number of digits pub fn digits_precision(x: f64, digits: usize) -> f64 { - let large_number: f64 = (10.0 as f64).powf(digits as f64); + let large_number: f64 = 10.0_f64.powf(digits as f64); (x * large_number).round() / large_number }