refactor: make clippy pedantic and thus change up a little code
This commit is contained in:
parent
504ab2aa3c
commit
d88075b365
4 changed files with 15 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
buffer::Buffer,
|
buffer::Buffer,
|
||||||
layout::{Constraint, Layout, Rect},
|
layout::{Constraint, Layout, Rect},
|
||||||
style::{Modifier, Style, palette::tailwind::*},
|
style::{Modifier, Style, palette::tailwind::NEUTRAL},
|
||||||
symbols,
|
symbols,
|
||||||
text::Line,
|
text::Line,
|
||||||
widgets::{Block, Borders, Widget},
|
widgets::{Block, Borders, Widget},
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#![warn(clippy::pedantic)]
|
||||||
|
#![allow(clippy::wildcard_imports)]
|
||||||
|
|
||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
|
|
||||||
mod game;
|
mod game;
|
||||||
|
|
|
@ -3,7 +3,10 @@ use ratatui::{
|
||||||
buffer::Buffer,
|
buffer::Buffer,
|
||||||
crossterm::event::{self, KeyCode, KeyEvent},
|
crossterm::event::{self, KeyCode, KeyEvent},
|
||||||
layout::{Constraint, Layout, Rect},
|
layout::{Constraint, Layout, Rect},
|
||||||
style::{Modifier, Style, Stylize, palette::tailwind::*},
|
style::{
|
||||||
|
Modifier, Style, Stylize,
|
||||||
|
palette::tailwind::*,
|
||||||
|
},
|
||||||
text::{Line, Span},
|
text::{Line, Span},
|
||||||
widgets::{
|
widgets::{
|
||||||
Block, Borders, HighlightSpacing, List, ListState, Padding, Paragraph, StatefulWidget,
|
Block, Borders, HighlightSpacing, List, ListState, Padding, Paragraph, StatefulWidget,
|
||||||
|
|
|
@ -9,7 +9,7 @@ use ratatui::{
|
||||||
|
|
||||||
use crate::game;
|
use crate::game;
|
||||||
use crate::menu;
|
use crate::menu;
|
||||||
use crate::util::*;
|
use crate::util::center;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub enum Mode {
|
pub enum Mode {
|
||||||
|
@ -32,15 +32,13 @@ impl Default for Mode {
|
||||||
impl Mode {
|
impl Mode {
|
||||||
pub fn run(mut self, mut terminal: DefaultTerminal) -> Result<()> {
|
pub fn run(mut self, mut terminal: DefaultTerminal) -> Result<()> {
|
||||||
loop {
|
loop {
|
||||||
match self {
|
if let Mode::Exit = self {
|
||||||
Mode::Exit => break,
|
break;
|
||||||
_ => {
|
|
||||||
terminal.draw(|frame| frame.render_widget(&mut self, frame.area()))?;
|
|
||||||
if let Event::Key(key) = event::read()? {
|
|
||||||
self = self.handle_key(key);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
terminal.draw(|frame| frame.render_widget(&mut self, frame.area()))?;
|
||||||
|
if let Event::Key(key) = event::read()? {
|
||||||
|
self = self.handle_key(key);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue