Skip to content

Commit 0e1ccba

Browse files
committed
code: cargo fmt
1 parent 21ddd79 commit 0e1ccba

File tree

6 files changed

+17
-21
lines changed

6 files changed

+17
-21
lines changed

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
mod application;
2121
mod config;
2222
mod discord_rpc;
23-
mod typing_test_utils;
2423
mod settings;
2524
mod text_generation;
2625
mod text_utils;
26+
mod typing_test_utils;
2727
mod widgets;
2828

2929
use self::application::KpApplication;

src/text_generation.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ type Numerals = [&'static str; 10];
154154

155155
const WESTERN_ARABIC_NUMERALS: &'static Numerals =
156156
&["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
157-
const PERSIAN_NUMERALS: &'static Numerals =
158-
&["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"];
157+
const PERSIAN_NUMERALS: &'static Numerals = &["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"];
159158
const DEVANAGARI_NUMERALS: &'static Numerals = &["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"];
160159
const BANGLA_NUMERALS: &'static Numerals = &["০", "১", "২", "৩", "৪", "৫", "৬", "৭", "৮", "৯"];
161160

@@ -310,7 +309,6 @@ pub fn advanced(language: Language) -> String {
310309
Punctuation::suffix("؟", true, 0.3),
311310
Punctuation::wrapping("\"", "\"", false, 0.0),
312311
Punctuation::wrapping("(", ")", false, 0.1),
313-
314312
],
315313
PERSIAN_NUMERALS,
316314
),
@@ -459,4 +457,3 @@ fn random_number_weighted(numerals: &Numerals, rng: &mut ThreadRng) -> String {
459457

460458
s
461459
}
462-

src/widgets/text_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ mod imp {
196196

197197
if change == TextChange::Addition {
198198
let last_grapheme_state = comparison
199-
.iter()
199+
.iter()
200200
.last()
201201
.map(|(state, _, _, _)| *state)
202202
.unwrap_or(GraphemeState::Unfinished);

src/widgets/text_view/input.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ impl imp::KpTextView {
121121
#[upgrade_or]
122122
glib::signal::Propagation::Proceed,
123123
move |controller, key, _, modifier| {
124-
if imp.typed_text.borrow().is_empty() { return glib::signal::Propagation::Proceed; }
124+
if imp.typed_text.borrow().is_empty() {
125+
return glib::signal::Propagation::Proceed;
126+
}
125127

126128
let obj = imp.obj();
127129

src/widgets/window.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ mod typing_test;
2323

2424
use crate::application::KpApplication;
2525
use crate::config::APP_ID;
26-
use crate::typing_test_utils::*;
2726
use crate::settings;
27+
use crate::typing_test_utils::*;
2828
use crate::widgets::{KpResultsView, KpTextView};
2929
use adw::prelude::*;
3030
use adw::subclass::prelude::*;

src/widgets/window/typing_test.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
*/
1919

2020
use super::*;
21-
use crate::typing_test_utils::TestSummary;
2221
use crate::text_generation;
2322
use crate::text_utils::{process_custom_text, GraphemeState};
23+
use crate::typing_test_utils::TestSummary;
2424
use crate::widgets::{KpCustomTextDialog, KpTextLanguageDialog};
2525
use gettextrs::gettext;
2626
use glib::ControlFlow;
@@ -276,10 +276,10 @@ impl imp::KpWindow {
276276
let settings = app.settings();
277277

278278
// Discord IPC
279-
self.obj().kp_application().discord_rpc().set_activity(
280-
TestConfig::from_settings(&settings),
281-
PresenceState::Ready,
282-
);
279+
self.obj()
280+
.kp_application()
281+
.discord_rpc()
282+
.set_activity(TestConfig::from_settings(&settings), PresenceState::Ready);
283283

284284
self.end_existing_inhibit();
285285
}
@@ -718,13 +718,11 @@ pub(super) fn add_personal_best(
718718
let (new_test_type, new_duration, new_language, new_wpm) = new;
719719

720720
old.into_iter()
721-
.filter(
722-
|(stored_test_type, stored_duration, stored_lang_code, _)| {
723-
*stored_test_type != new_test_type
724-
|| *stored_duration != new_duration
725-
|| *stored_lang_code != new_language
726-
},
727-
)
721+
.filter(|(stored_test_type, stored_duration, stored_lang_code, _)| {
722+
*stored_test_type != new_test_type
723+
|| *stored_duration != new_duration
724+
|| *stored_lang_code != new_language
725+
})
728726
.chain(once((
729727
new_test_type.to_string(),
730728
new_duration.to_string(),
@@ -733,4 +731,3 @@ pub(super) fn add_personal_best(
733731
)))
734732
.collect()
735733
}
736-

0 commit comments

Comments
 (0)