Skip to content

Commit

Permalink
style: format all code
Browse files Browse the repository at this point in the history
  • Loading branch information
max-niederman committed Jun 7, 2023
1 parent 7821c98 commit e2951cb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use ratatui::style::{Color, Modifier, Style};
use serde::{
de::{self, IntoDeserializer},
Deserialize,
};
use ratatui::style::{Color, Modifier, Style};

#[derive(Debug, Deserialize)]
#[serde(default)]
Expand Down
10 changes: 6 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ use test::{results::Results, Test};

use crossterm::{
self, cursor,
event::{self, Event, KeyCode, KeyEvent, KeyModifiers, KeyEventKind},
event::{self, Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers},
execute, terminal,
};
use rand::{seq::SliceRandom, thread_rng};
use ratatui::{backend::CrosstermBackend, terminal::Terminal};
use rust_embed::RustEmbed;
use std::{
ffi::OsString,
Expand All @@ -21,7 +22,6 @@ use std::{
str,
};
use structopt::StructOpt;
use ratatui::{backend::CrosstermBackend, terminal::Terminal};

#[derive(RustEmbed)]
#[folder = "resources/runtime"]
Expand Down Expand Up @@ -115,15 +115,17 @@ impl Opt {
}
}


/// Configuration
fn config(&self) -> Config {
fs::read(
self.config
.clone()
.unwrap_or_else(|| self.config_dir().join("config.toml")),
)
.map(|bytes| toml::from_str(str::from_utf8(&bytes).unwrap_or_default()).expect("Configuration was ill-formed."))
.map(|bytes| {
toml::from_str(str::from_utf8(&bytes).unwrap_or_default())
.expect("Configuration was ill-formed.")
})
.unwrap_or_default()
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub mod results;

use crossterm::event::{KeyCode, KeyEvent, KeyModifiers, KeyEventKind};
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
use std::fmt;
use std::time::Instant;

Expand Down
6 changes: 3 additions & 3 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ use super::test::{results, Test};

use crossterm::event::KeyCode;
use crossterm::event::KeyEvent;
use results::Fraction;
use std::iter;
use ratatui::{
buffer::Buffer,
layout::{Constraint, Direction, Layout, Rect},
symbols::Marker,
text::{Span, Line, Text},
text::{Line, Span, Text},
widgets::{Axis, Block, BorderType, Borders, Chart, Dataset, GraphType, Paragraph, Widget},
};
use results::Fraction;
use std::iter;

// Convert CPS to WPM (clicks per second)
const WPM_PER_CPS: f64 = 12.0;
Expand Down

0 comments on commit e2951cb

Please sign in to comment.