1
0

fix compiler warnings

This commit is contained in:
Rokas Puzonas 2023-01-29 23:51:49 +02:00
parent 0602d668bc
commit 640a0a8835
4 changed files with 6 additions and 9 deletions

View File

@ -1,4 +1,4 @@
use std::{ops::Add, rc::Rc, cell::{Cell, RefCell}, f64::consts::E}; use std::{ops::Add, rc::Rc, cell::RefCell};
use eframe::{egui, CreationContext}; use eframe::{egui, CreationContext};
use chrono::{Datelike, NaiveDate, Weekday, IsoWeek, Duration, Days, Local}; use chrono::{Datelike, NaiveDate, Weekday, IsoWeek, Duration, Days, Local};
@ -29,7 +29,6 @@ pub struct MainApp {
config: Option<Config>, config: Option<Config>,
assets: Option<AppAssets>, assets: Option<AppAssets>,
vidko_textfield: String,
screen: Option<Rc<RefCell<dyn Screen>>> screen: Option<Rc<RefCell<dyn Screen>>>
} }
@ -51,8 +50,6 @@ fn get_current_week() -> IsoWeek {
fn get_future_week(week_offset: u64) -> IsoWeek { fn get_future_week(week_offset: u64) -> IsoWeek {
let now_week = get_current_week(); let now_week = get_current_week();
let year = now_week.year();
let week = now_week.week();
let week_date = NaiveDate::from_isoywd_opt(now_week.year(), now_week.week(), Weekday::Mon).expect("Invalid week or year given"); let week_date = NaiveDate::from_isoywd_opt(now_week.year(), now_week.week(), Weekday::Mon).expect("Invalid week or year given");
week_date.checked_add_days(Days::new(7 * week_offset)).unwrap().iso_week() week_date.checked_add_days(Days::new(7 * week_offset)).unwrap().iso_week()
} }
@ -144,7 +141,6 @@ impl MainApp {
assets: None, assets: None,
config_store, config_store,
config: None, config: None,
vidko_textfield: String::new(),
timetable_getter, timetable_getter,
screen: None screen: None
} }

View File

@ -100,6 +100,7 @@ pub struct MemoryConfigStore {
config: Option<Config> config: Option<Config>
} }
impl MemoryConfigStore { impl MemoryConfigStore {
#[allow(unused)]
pub fn new(config: Config) -> Self { pub fn new(config: Config) -> Self {
Self { config: Some(config) } Self { config: Some(config) }
} }

View File

@ -10,10 +10,9 @@ mod utils;
extern crate lazy_static; extern crate lazy_static;
use app::MainApp; use app::MainApp;
use chrono::{Local, NaiveDate, NaiveTime}; use config::TomlConfigStore;
use config::{MemoryConfigStore, Config, TomlConfigStore};
use eframe::egui; use eframe::egui;
use timetable::{DummyTimetableGetter, Timetable, Event, BlockingTimetableGetter}; use timetable::BlockingTimetableGetter;
// TODO: show errors when loading config // TODO: show errors when loading config
// TODO: Settings menu // TODO: Settings menu

View File

@ -139,12 +139,13 @@ pub struct DummyTimetableGetter {
timetable: Timetable timetable: Timetable
} }
impl DummyTimetableGetter { impl DummyTimetableGetter {
#[allow(unused)]
pub fn new(timetable: Timetable) -> Self { pub fn new(timetable: Timetable) -> Self {
Self { timetable } Self { timetable }
} }
} }
impl TimetableGetter for DummyTimetableGetter { impl TimetableGetter for DummyTimetableGetter {
fn get(&self, vidko: &str) -> Result<Timetable, GetTimetableError> { fn get(&self, _vidko: &str) -> Result<Timetable, GetTimetableError> {
Ok(self.timetable.clone()) Ok(self.timetable.clone())
} }
} }