From 4acf034b8d4da82b0cac3673202d2e248b4e46af Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Mon, 29 Jan 2024 23:42:14 -0500 Subject: [PATCH] Clean up warnings and remove printlns --- emseries/src/types.rs | 2 +- emseries/tests/test_io.rs | 11 +++++------ fitnesstrax/app/src/app_window.rs | 4 ---- fitnesstrax/app/src/components/day.rs | 1 - fitnesstrax/app/src/components/mod.rs | 3 ++- fitnesstrax/app/src/components/time_distance.rs | 2 +- fitnesstrax/app/src/types.rs | 8 -------- fitnesstrax/app/src/view_models/day_detail.rs | 2 -- 8 files changed, 9 insertions(+), 24 deletions(-) diff --git a/emseries/src/types.rs b/emseries/src/types.rs index e10298c..9f92395 100644 --- a/emseries/src/types.rs +++ b/emseries/src/types.rs @@ -201,7 +201,7 @@ mod test { impl Recordable for WeightRecord { fn timestamp(&self) -> Timestamp { - Timestamp::Date(self.date.clone()) + Timestamp::Date(self.date) } fn tags(&self) -> Vec { diff --git a/emseries/tests/test_io.rs b/emseries/tests/test_io.rs index 77142c4..330a875 100644 --- a/emseries/tests/test_io.rs +++ b/emseries/tests/test_io.rs @@ -20,7 +20,7 @@ extern crate emseries; #[cfg(test)] mod test { - use chrono::{format::Fixed, prelude::*}; + use chrono::{prelude::*}; use chrono_tz::Etc::UTC; use dimensioned::si::{Kilogram, Meter, Second, M, S}; @@ -42,7 +42,7 @@ mod test { impl Recordable for BikeTrip { fn timestamp(&self) -> Timestamp { - Timestamp::DateTime(self.datetime.clone()) + Timestamp::DateTime(self.datetime) } fn tags(&self) -> Vec { Vec::new() @@ -99,7 +99,7 @@ mod test { ] } - fn run_test(test: T) -> () + fn run_test(test: T) where T: FnOnce(tempfile::TempPath), { @@ -108,7 +108,7 @@ mod test { test(tmp_path); } - fn run(test: T) -> () + fn run(test: T) where T: FnOnce(Series), { @@ -280,8 +280,7 @@ mod test { UTC.with_ymd_and_hms(2011, 11, 04, 0, 0, 0) .unwrap() .with_timezone(&FixedOffset::east_opt(0).unwrap()), - ) - .into(), + ), true, ), |l, r| l.timestamp().cmp(&r.timestamp()), diff --git a/fitnesstrax/app/src/app_window.rs b/fitnesstrax/app/src/app_window.rs index 238e2f3..0a127c4 100644 --- a/fitnesstrax/app/src/app_window.rs +++ b/fitnesstrax/app/src/app_window.rs @@ -99,10 +99,6 @@ impl AppWindow { window.set_content(Some(&navigation)); window.present(); - let gesture = gtk::GestureClick::new(); - gesture.connect_released(|_, _, _, _| println!("detected gesture")); - layout.add_controller(gesture); - let s = Self { app: ft_app, layout, diff --git a/fitnesstrax/app/src/components/day.rs b/fitnesstrax/app/src/components/day.rs index a2cfd1e..289f1a5 100644 --- a/fitnesstrax/app/src/components/day.rs +++ b/fitnesstrax/app/src/components/day.rs @@ -264,7 +264,6 @@ impl DayEdit { } fn add_row(&self, workout: Record) { - println!("adding a row for {:?}", workout); let workout_rows = self.imp().workout_rows.borrow(); #[allow(clippy::single_match)] diff --git a/fitnesstrax/app/src/components/mod.rs b/fitnesstrax/app/src/components/mod.rs index 59f7347..c1da4fd 100644 --- a/fitnesstrax/app/src/components/mod.rs +++ b/fitnesstrax/app/src/components/mod.rs @@ -11,7 +11,8 @@ FitnessTrax is distributed in the hope that it will be useful, but WITHOUT ANY W even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along with FitnessTrax. If not, see . +You should have received a copy of the GNU General Public License along with FitnessTrax. If not, +see . */ mod action_group; diff --git a/fitnesstrax/app/src/components/time_distance.rs b/fitnesstrax/app/src/components/time_distance.rs index 02bfe27..7b800c1 100644 --- a/fitnesstrax/app/src/components/time_distance.rs +++ b/fitnesstrax/app/src/components/time_distance.rs @@ -25,7 +25,7 @@ use dimensioned::si; use ft_core::{TimeDistance, TimeDistanceActivity}; use glib::Object; use gtk::{prelude::*, subclass::prelude::*}; -use std::{cell::RefCell, rc::Rc}; +use std::{rc::Rc, cell::RefCell}; pub fn time_distance_summary( distance: DistanceFormatter, diff --git a/fitnesstrax/app/src/types.rs b/fitnesstrax/app/src/types.rs index a0614c3..8ed75fd 100644 --- a/fitnesstrax/app/src/types.rs +++ b/fitnesstrax/app/src/types.rs @@ -256,14 +256,6 @@ impl From> for DurationFormatter { } } -/* -fn take_digits(s: String) -> String { - s.chars() - .take_while(|t| t.is_ascii_digit()) - .collect::() -} -*/ - #[cfg(test)] mod test { use super::*; diff --git a/fitnesstrax/app/src/view_models/day_detail.rs b/fitnesstrax/app/src/view_models/day_detail.rs index 21688c0..a8f3c08 100644 --- a/fitnesstrax/app/src/view_models/day_detail.rs +++ b/fitnesstrax/app/src/view_models/day_detail.rs @@ -230,12 +230,10 @@ impl DayDetailViewModel { } pub fn update_record(&self, update: Record) { - println!("updating a record: {:?}", update); let mut records = self.records.write().unwrap(); records .entry(update.id) .and_modify(|record| record.set_value(update.data)); - println!("record updated: {:?}", records.get(&update.id)); } pub fn records(&self) -> Vec> {