Some autoated fixes.
This commit is contained in:
+5
-5
@@ -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<Local>) -> Box<Vec<Arrival>> {
|
||||
pub fn get_next_arrivals_for(&self, target_datetime: &DateTime<Local>) -> Box<Vec<Arrival<'_>>> {
|
||||
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<Arrival> = 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() {
|
||||
|
||||
Reference in New Issue
Block a user