From 0a7a425ea724ef1d704761ef271fc208869c53e9 Mon Sep 17 00:00:00 2001 From: Nahuel Lofeudo Date: Mon, 25 May 2026 07:49:47 +0100 Subject: [PATCH] Addressed some warnings, moved a few debug!() to trace!() --- src/gtfs/refresher.rs | 4 ++-- src/gtfs/structs.rs | 10 +++++----- src/renderer/mod.rs | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gtfs/refresher.rs b/src/gtfs/refresher.rs index 3e45d23..45894d4 100644 --- a/src/gtfs/refresher.rs +++ b/src/gtfs/refresher.rs @@ -1,4 +1,4 @@ -use log::{debug, error, info}; +use log::{debug, info}; use time_format::format_common_utc; use std::{fs::{self}, time::{Duration, SystemTime, UNIX_EPOCH}}; use crate::gtfs::structs::{Error, Preferences}; @@ -57,5 +57,5 @@ pub(crate) fn refresh(prefs: &Preferences) -> Result<(), Error> { } let errmsg = format!("GET on {} returned result code {}", prefs.gtfs_url, response.status()); - return Err(Error { message: errmsg }); + return Err(Error { _message: errmsg }); } diff --git a/src/gtfs/structs.rs b/src/gtfs/structs.rs index 5db7ed3..75bcdef 100644 --- a/src/gtfs/structs.rs +++ b/src/gtfs/structs.rs @@ -7,24 +7,24 @@ use zip::result::ZipError; #[derive(Debug)] pub struct Error { - pub(crate) message: String, + pub(crate) _message: String, } impl From for Error { fn from(value: std::io::Error) -> Self { - return Error { message: value.to_string() } + return Error { _message: value.to_string() } } } impl From for Error { fn from(value: reqwest::Error) -> Self { - return Error { message: value.to_string() } + return Error { _message: value.to_string() } } } impl From for Error { fn from(value: ZipError) -> Self { - return Error { message: value.to_string() } + return Error { _message: value.to_string() } } } @@ -60,7 +60,7 @@ impl Preferences { let file_name_part = self.gtfs_url.split("/").last(); if file_name_part.is_none() { error!("The config for gtfs-url is not a valid URL: {}", self.gtfs_url); - return Err(Error {message: String::from("Failed to refresh GTFS data")}); + return Err(Error {_message: String::from("Failed to refresh GTFS data")}); } return Ok(String::from(file_name_part.unwrap())); } diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 1ed082f..6126260 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -1,7 +1,7 @@ pub mod structs; use std::{cmp::min}; use chrono::{Datelike, Local, Timelike}; -use log::{debug, error, warn}; +use log::{error, trace, warn}; use sdl3::{Sdl, pixels::Color, rect::Rect}; use structs::{Prefs, DisplayData}; @@ -12,7 +12,7 @@ const COLOR_LCD_AMBER : Color = Color::RGB(0xf4, 0xcb, 0x60); const COLOR_LCD_GREEN : Color = Color::RGB(0xb3, 0xff, 0x00); const COLOR_LCD_RED : Color = Color::RGB(0xff, 0x3a, 0x4a); const COLOR_BACKGROUND : Color = Color::RGB(0x0, 0x0, 0x0 ); -const COLOR_TEXT_BG : Color = Color::RGBA(0x0, 0x0, 0x0, 0x0); +const _COLOR_TEXT_BG : Color = Color::RGBA(0x0, 0x0, 0x0, 0x0); const TEXT_SIZE: f32 = 160.0; // Size of the font in pixels // Offsets of each part within a line @@ -34,7 +34,7 @@ impl Screen<'_> { } fn format_due_for(&self, due_in_mins: i32, departure_time: u32) -> String { - debug!("Due in mins: {:02}", due_in_mins); + trace!("Due in mins: {:02}", due_in_mins); if due_in_mins <= 1 { return String::from("due"); }