Addressed some warnings, moved a few debug!() to trace!()

This commit is contained in:
Nahuel Lofeudo 2026-05-25 07:49:47 +01:00
parent dc368ca811
commit 0a7a425ea7
3 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
use log::{debug, error, info}; use log::{debug, info};
use time_format::format_common_utc; use time_format::format_common_utc;
use std::{fs::{self}, time::{Duration, SystemTime, UNIX_EPOCH}}; use std::{fs::{self}, time::{Duration, SystemTime, UNIX_EPOCH}};
use crate::gtfs::structs::{Error, Preferences}; 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()); let errmsg = format!("GET on {} returned result code {}", prefs.gtfs_url, response.status());
return Err(Error { message: errmsg }); return Err(Error { _message: errmsg });
} }

View File

@ -7,24 +7,24 @@ use zip::result::ZipError;
#[derive(Debug)] #[derive(Debug)]
pub struct Error { pub struct Error {
pub(crate) message: String, pub(crate) _message: String,
} }
impl From<std::io::Error> for Error { impl From<std::io::Error> for Error {
fn from(value: std::io::Error) -> Self { fn from(value: std::io::Error) -> Self {
return Error { message: value.to_string() } return Error { _message: value.to_string() }
} }
} }
impl From<reqwest::Error> for Error { impl From<reqwest::Error> for Error {
fn from(value: reqwest::Error) -> Self { fn from(value: reqwest::Error) -> Self {
return Error { message: value.to_string() } return Error { _message: value.to_string() }
} }
} }
impl From<ZipError> for Error { impl From<ZipError> for Error {
fn from(value: ZipError) -> Self { 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(); let file_name_part = self.gtfs_url.split("/").last();
if file_name_part.is_none() { if file_name_part.is_none() {
error!("The config for gtfs-url is not a valid URL: {}", self.gtfs_url); 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())); return Ok(String::from(file_name_part.unwrap()));
} }

View File

@ -1,7 +1,7 @@
pub mod structs; pub mod structs;
use std::{cmp::min}; use std::{cmp::min};
use chrono::{Datelike, Local, Timelike}; use chrono::{Datelike, Local, Timelike};
use log::{debug, error, warn}; use log::{error, trace, warn};
use sdl3::{Sdl, pixels::Color, rect::Rect}; use sdl3::{Sdl, pixels::Color, rect::Rect};
use structs::{Prefs, DisplayData}; 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_GREEN : Color = Color::RGB(0xb3, 0xff, 0x00);
const COLOR_LCD_RED : Color = Color::RGB(0xff, 0x3a, 0x4a); const COLOR_LCD_RED : Color = Color::RGB(0xff, 0x3a, 0x4a);
const COLOR_BACKGROUND : Color = Color::RGB(0x0, 0x0, 0x0 ); 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 const TEXT_SIZE: f32 = 160.0; // Size of the font in pixels
// Offsets of each part within a line // 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 { 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 { if due_in_mins <= 1 {
return String::from("due"); return String::from("due");
} }