From ca6857dda9b6b1fa965368fb11b14c5105670bdb Mon Sep 17 00:00:00 2001 From: Nahuel Lofeudo Date: Mon, 27 Apr 2026 21:02:41 +0100 Subject: [PATCH] Some autoated fixes. --- src/gtfs/mod.rs | 10 +++++----- src/gtfs/structs.rs | 2 +- src/main.rs | 2 +- src/renderer/mod.rs | 4 ++-- src/renderer/structs.rs | 1 - 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/gtfs/mod.rs b/src/gtfs/mod.rs index 52d49e4..ca11e96 100644 --- a/src/gtfs/mod.rs +++ b/src/gtfs/mod.rs @@ -1,12 +1,12 @@ mod loader; mod utils; pub mod structs; -use chrono::{DateTime, Local, NaiveDate, NaiveDateTime}; +use chrono::{DateTime, Local}; use std::{ collections::{HashMap, HashSet}, fs::File, }; -use gtfs_structures::{Agency, Calendar, CalendarDate, Exception, RawStopTime, RawTrip, Route, Stop, TimepointType, Trip}; +use gtfs_structures::{Agency, Calendar, CalendarDate, Exception, RawStopTime, RawTrip, Route, Stop}; use crate::gtfs::{loader::load_gtfs, structs::{Arrival, Preferences}}; @@ -32,7 +32,7 @@ pub struct Gtfs { impl Gtfs { - pub fn get_next_arrivals_for(&self, target_datetime: &DateTime) -> Box> { + pub fn get_next_arrivals_for(&self, target_datetime: &DateTime) -> Box>> { let naive_target = target_datetime.naive_local(); let target_date = naive_target.date(); @@ -64,7 +64,7 @@ impl Gtfs { // Find the trips happening on these calendars let mut trips: HashMap<&String, &RawTrip> = HashMap::new(); - for (id, trip) in self.trips.iter() { + for (_id, trip) in self.trips.iter() { if active_service_ids.contains(&trip.service_id) { trips.insert(&trip.id, trip); } @@ -73,7 +73,7 @@ impl Gtfs { // Finally, find the arrivals for the active trips on the chosen stops let mut arrivals: Vec = Vec::new(); let current_timestamp = target_datetime.timestamp(); - for (id, stop_time) in self.stop_times.iter() { + for (_id, stop_time) in self.stop_times.iter() { if trips.contains_key(&stop_time.trip_id) { let stop_timestamp = stop_time.departure_time.or(stop_time.arrival_time).unwrap(); if current_timestamp < stop_timestamp.into() { diff --git a/src/gtfs/structs.rs b/src/gtfs/structs.rs index c285dea..60e69a8 100644 --- a/src/gtfs/structs.rs +++ b/src/gtfs/structs.rs @@ -1,6 +1,6 @@ use std::collections::{HashSet}; -use gtfs_structures::{TimepointType, Route, Stop}; +use gtfs_structures::{Route, Stop}; // This is to store the preferences for the GTFS(-R) side of the code. pub struct Preferences { diff --git a/src/main.rs b/src/main.rs index 12bed50..f5fbcf7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ mod gtfs; mod renderer; -use std::{collections::HashSet, process, thread, time::SystemTime}; +use std::{collections::HashSet, process, time::SystemTime}; use chrono::{DateTime, Local}; use sdl3::event::Event; diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index df404f7..1e761fe 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -1,7 +1,7 @@ pub mod structs; -use sdl3::{Sdl, pixels::Color, rect::Rect, render::Canvas, sys::metadata::render, ttf::Font, video::Window}; +use sdl3::{Sdl, pixels::Color, rect::Rect, render::Canvas, ttf::Font, video::Window}; use structs::{Prefs}; pub struct Screen<'a> { @@ -35,7 +35,7 @@ impl Screen<'_> { /// Initialize video, allocate buffers and load fonts /// Based on https://github.com/vhspace/sdl3-rs/blob/master/examples/ttf-demo.rs - pub fn init(prefs: &Prefs) -> Screen { + pub fn init(prefs: &Prefs) -> Screen<'_> { // Initialize the screen let sdl_context = sdl3::init().unwrap(); let video_subsys = sdl_context.video().unwrap(); diff --git a/src/renderer/structs.rs b/src/renderer/structs.rs index 147fef7..75ca0ea 100644 --- a/src/renderer/structs.rs +++ b/src/renderer/structs.rs @@ -1,4 +1,3 @@ -use sdl3::{render::Canvas, ttf::Font, video::Window}; pub struct Prefs { pub font_path: String,