From ace54b10e13ab996784bfdad2ab71f72476baf0b Mon Sep 17 00:00:00 2001 From: Mikhail Mitrofanov Date: Wed, 9 Sep 2026 15:03:54 +0300 Subject: [PATCH] remove clone from states --- src/pages/history.rs | 4 ---- src/pages/import.rs | 1 - src/pages/quiz.rs | 1 - src/pages/randomizer.rs | 1 - src/pages/repetitions.rs | 1 - src/pages/sync.rs | 1 - src/pages/word.rs | 1 - src/pages/writing.rs | 1 - 8 files changed, 11 deletions(-) diff --git a/src/pages/history.rs b/src/pages/history.rs index b3a730c..382e9d6 100644 --- a/src/pages/history.rs +++ b/src/pages/history.rs @@ -11,10 +11,8 @@ use iced::widget::*; use iced::{Element, Fill, FillPortion, Task}; use std::sync::Arc; -#[derive(Clone)] pub struct HistoryState { list: Vec<(WordData, HistoryNote)>, - pub state: AppState, } impl NavigatedPage for HistoryState { @@ -50,7 +48,6 @@ impl HistoryState { let dict = &state.dictionary.read(); let history_repo = &mut state.history.write(); history_repo.init().expect("TODO: panic message"); - let id = id; let mut history = history_repo.query(Arc::new(move |h| h.deck_id == id)); let words = history .iter(history_repo) @@ -69,7 +66,6 @@ impl HistoryState { .collect(); Self { list: words, - state: state.clone(), } } diff --git a/src/pages/import.rs b/src/pages/import.rs index 7d72651..6633340 100644 --- a/src/pages/import.rs +++ b/src/pages/import.rs @@ -34,7 +34,6 @@ use zip::ZipArchive; const DEFAULT_FIELDS: [&str; 6] = ["key", "value", "tags", "reading", "context", "description"]; -#[derive(Clone)] pub struct ImportState { state: AppState, path: Option, diff --git a/src/pages/quiz.rs b/src/pages/quiz.rs index b50c361..8a6fee1 100644 --- a/src/pages/quiz.rs +++ b/src/pages/quiz.rs @@ -9,7 +9,6 @@ use iced::widget::*; use iced::{Element, Fill, Task, alignment}; use rand::seq::SliceRandom; -#[derive(Clone, Debug)] pub struct QuizState { kana: String, current_roman: String, diff --git a/src/pages/randomizer.rs b/src/pages/randomizer.rs index c0dcff6..107631f 100644 --- a/src/pages/randomizer.rs +++ b/src/pages/randomizer.rs @@ -7,7 +7,6 @@ use iced::Task; use iced::widget::text_editor; use rand::prelude::SliceRandom; -#[derive(Clone, Debug)] pub struct RandomizerState { text: text_editor::Content, list: Vec, diff --git a/src/pages/repetitions.rs b/src/pages/repetitions.rs index 27e2acd..d33cbf3 100644 --- a/src/pages/repetitions.rs +++ b/src/pages/repetitions.rs @@ -31,7 +31,6 @@ use std::collections::BTreeMap; use std::ops::Deref; use std::sync::Arc; -#[derive(Clone)] pub struct RepetitionsState { selected_deck_handle: Option>, decks: BTreeMap, DeckRunData>, diff --git a/src/pages/sync.rs b/src/pages/sync.rs index db92f77..cead796 100644 --- a/src/pages/sync.rs +++ b/src/pages/sync.rs @@ -32,7 +32,6 @@ pub enum SyncMessage { DisableSync, SwitchAutoSync, } -#[derive(Clone)] pub struct SyncState { state: AppState, auto_fetch: bool, diff --git a/src/pages/word.rs b/src/pages/word.rs index aafc7b5..6232f66 100644 --- a/src/pages/word.rs +++ b/src/pages/word.rs @@ -8,7 +8,6 @@ use iced::widget::button::danger; use iced::widget::{button, column, row, space, text, text_input}; use iced::{Element, Fill, Task}; -#[derive(Clone)] pub struct WordState { state: AppState, handle: EntityHandle, diff --git a/src/pages/writing.rs b/src/pages/writing.rs index 20db3f5..c8a8642 100644 --- a/src/pages/writing.rs +++ b/src/pages/writing.rs @@ -7,7 +7,6 @@ use iced::widget::*; use iced::{Element, Fill, Task, alignment}; use rand::seq::SliceRandom; -#[derive(Clone, Debug)] pub struct WritingState { kana: String, set: Vec<(String, String)>,