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::{
|
||||
buffer::Buffer,
|
||||
layout::{Constraint, Layout, Rect},
|
||||
style::{Modifier, Style, palette::tailwind::*},
|
||||
style::{Modifier, Style, palette::tailwind::NEUTRAL},
|
||||
symbols,
|
||||
text::Line,
|
||||
widgets::{Block, Borders, Widget},
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#![warn(clippy::pedantic)]
|
||||
#![allow(clippy::wildcard_imports)]
|
||||
|
||||
use color_eyre::Result;
|
||||
|
||||
mod game;
|
||||
|
|
|
@ -3,7 +3,10 @@ use ratatui::{
|
|||
buffer::Buffer,
|
||||
crossterm::event::{self, KeyCode, KeyEvent},
|
||||
layout::{Constraint, Layout, Rect},
|
||||
style::{Modifier, Style, Stylize, palette::tailwind::*},
|
||||
style::{
|
||||
Modifier, Style, Stylize,
|
||||
palette::tailwind::*,
|
||||
},
|
||||
text::{Line, Span},
|
||||
widgets::{
|
||||
Block, Borders, HighlightSpacing, List, ListState, Padding, Paragraph, StatefulWidget,
|
||||
|
|
|
@ -9,7 +9,7 @@ use ratatui::{
|
|||
|
||||
use crate::game;
|
||||
use crate::menu;
|
||||
use crate::util::*;
|
||||
use crate::util::center;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Mode {
|
||||
|
@ -32,16 +32,14 @@ impl Default for Mode {
|
|||
impl Mode {
|
||||
pub fn run(mut self, mut terminal: DefaultTerminal) -> Result<()> {
|
||||
loop {
|
||||
match self {
|
||||
Mode::Exit => break,
|
||||
_ => {
|
||||
if let Mode::Exit = self {
|
||||
break;
|
||||
}
|
||||
terminal.draw(|frame| frame.render_widget(&mut self, frame.area()))?;
|
||||
if let Event::Key(key) = event::read()? {
|
||||
self = self.handle_key(key);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue