Migrate to String::new()
This commit is contained in:
1 parent
1d4b37e381
commit
a5526dc5e9
8 files changed
+19
-19
No files matched your search
@@ -133,8 +133,8 @@ impl DeckSettings {
|
|||||||
DeckSettings {
|
DeckSettings {
|
||||||
id: 0.into(),
|
id: 0.into(),
|
||||||
name,
|
name,
|
||||||
forward: "".to_string(),
|
forward: String::new(),
|
||||||
backward: "".to_string(),
|
backward: String::new(),
|
||||||
filter: "true".to_string(),
|
filter: "true".to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ impl DictionaryState {
|
|||||||
tag_map: HashMap::new(),
|
tag_map: HashMap::new(),
|
||||||
words_tags: vec![],
|
words_tags: vec![],
|
||||||
reverse: false,
|
reverse: false,
|
||||||
search: "".to_string(),
|
search: String::new(),
|
||||||
no_typing: true,
|
no_typing: true,
|
||||||
reverse_list: true,
|
reverse_list: true,
|
||||||
auto_save_queue: HashMap::new(),
|
auto_save_queue: HashMap::new(),
|
||||||
@@ -717,7 +717,7 @@ impl DictionaryState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn selection_editor(&self) -> iced::Element<'_, DictionaryMessage> {
|
fn selection_editor(&self) -> iced::Element<'_, DictionaryMessage> {
|
||||||
let mut display = "".to_string();
|
let mut display = String::new();
|
||||||
let mut editable = false;
|
let mut editable = false;
|
||||||
if let Some(selected) = self.selected_cell.as_ref() {
|
if let Some(selected) = self.selected_cell.as_ref() {
|
||||||
let mut dictionary = self.state.dictionary.write();
|
let mut dictionary = self.state.dictionary.write();
|
||||||
|
|||||||
@@ -114,9 +114,9 @@ impl DictionaryQuizState {
|
|||||||
state,
|
state,
|
||||||
words,
|
words,
|
||||||
current_set: Vec::new(),
|
current_set: Vec::new(),
|
||||||
answer: "".to_string(),
|
answer: String::new(),
|
||||||
view: "---".to_string(),
|
view: "---".to_string(),
|
||||||
correct: "".to_string(),
|
correct: String::new(),
|
||||||
score: Default::default(),
|
score: Default::default(),
|
||||||
is_help: false,
|
is_help: false,
|
||||||
reverse,
|
reverse,
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ impl HistoryState {
|
|||||||
id: Default::default(),
|
id: Default::default(),
|
||||||
group_id: Default::default(),
|
group_id: Default::default(),
|
||||||
key: "Удаленное слово".to_string(),
|
key: "Удаленное слово".to_string(),
|
||||||
value: "".to_string(),
|
value: String::new(),
|
||||||
tags: "".to_string(),
|
tags: String::new(),
|
||||||
additional: Default::default(),
|
additional: Default::default(),
|
||||||
});
|
});
|
||||||
(word, item.clone())
|
(word, item.clone())
|
||||||
|
|||||||
+1
-1
@@ -329,7 +329,7 @@ impl ImportState {
|
|||||||
import_data: None,
|
import_data: None,
|
||||||
selected_index: 0,
|
selected_index: 0,
|
||||||
selected_property: None,
|
selected_property: None,
|
||||||
custom_property_name: "".to_string(),
|
custom_property_name: String::new(),
|
||||||
skip_empty: true,
|
skip_empty: true,
|
||||||
separator: ", ".to_string(),
|
separator: ", ".to_string(),
|
||||||
progress: None,
|
progress: None,
|
||||||
|
|||||||
+1
-1
@@ -113,7 +113,7 @@ impl QuizState {
|
|||||||
kana: "ぁ".to_string(),
|
kana: "ぁ".to_string(),
|
||||||
correct_roman: "a".to_string(),
|
correct_roman: "a".to_string(),
|
||||||
is_help: false,
|
is_help: false,
|
||||||
current_roman: "".to_string(),
|
current_roman: String::new(),
|
||||||
set: KanaSet::hiragana(),
|
set: KanaSet::hiragana(),
|
||||||
queue: Vec::new(),
|
queue: Vec::new(),
|
||||||
score: Score {
|
score: Score {
|
||||||
|
|||||||
+3
-3
@@ -7,7 +7,7 @@ use crate::pages::word::WordMessage::*;
|
|||||||
use crate::styling::*;
|
use crate::styling::*;
|
||||||
use iced::widget::button::danger;
|
use iced::widget::button::danger;
|
||||||
use iced::widget::space::horizontal;
|
use iced::widget::space::horizontal;
|
||||||
use iced::widget::{button, column, row, rule, scrollable, text, text_input};
|
use iced::widget::{button, column, row, rule, scrollable, text};
|
||||||
use iced::{Element, Fill};
|
use iced::{Element, Fill};
|
||||||
use iced_core::Padding;
|
use iced_core::Padding;
|
||||||
|
|
||||||
@@ -35,10 +35,10 @@ impl<Message> WordEditor<Message> {
|
|||||||
word.value = n;
|
word.value = n;
|
||||||
}
|
}
|
||||||
SetAdditional(key, value) => {
|
SetAdditional(key, value) => {
|
||||||
word.additional.insert(key, value.clone());
|
word.additional.insert(key, value.replace("", ""));
|
||||||
}
|
}
|
||||||
AddAdditional(key) => {
|
AddAdditional(key) => {
|
||||||
word.additional.insert(key, "".to_string());
|
word.additional.insert(key, String::new());
|
||||||
}
|
}
|
||||||
RemoveAdditional(key) => {
|
RemoveAdditional(key) => {
|
||||||
word.additional.remove(&key);
|
word.additional.remove(&key);
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ impl WritingState {
|
|||||||
let mut list = set.list();
|
let mut list = set.list();
|
||||||
list.shuffle(&mut rand::rng());
|
list.shuffle(&mut rand::rng());
|
||||||
WritingState {
|
WritingState {
|
||||||
kana: "".to_string(),
|
kana: String::new(),
|
||||||
set: list.clone(),
|
set: list.clone(),
|
||||||
original_set: list,
|
original_set: list,
|
||||||
kana_total: "".to_string(),
|
kana_total: String::new(),
|
||||||
roman_total: "".to_string(),
|
roman_total: String::new(),
|
||||||
next_text: "Дальше".to_string(),
|
next_text: "Дальше".to_string(),
|
||||||
show_all: false,
|
show_all: false,
|
||||||
}
|
}
|
||||||
@@ -79,9 +79,9 @@ impl WritingState {
|
|||||||
impl WritingState {
|
impl WritingState {
|
||||||
fn next(&mut self) {
|
fn next(&mut self) {
|
||||||
if self.set.is_empty() {
|
if self.set.is_empty() {
|
||||||
self.kana = "".to_string();
|
self.kana = String::new();
|
||||||
self.roman_total = "".to_string();
|
self.roman_total = String::new();
|
||||||
self.kana_total = "".to_string();
|
self.kana_total = String::new();
|
||||||
|
|
||||||
self.set = self.original_set.clone();
|
self.set = self.original_set.clone();
|
||||||
self.set.shuffle(&mut rand::rng());
|
self.set.shuffle(&mut rand::rng());
|
||||||
|
|||||||
Reference in new issue
Block a user