refactor: make clippy pedantic and thus change up a little code

This commit is contained in:
Muhammad Nauman Raza 2025-02-21 15:25:58 +00:00
parent 504ab2aa3c
commit d88075b365
Signed by: devraza
GPG key ID: 91EAD6081011574B
4 changed files with 15 additions and 11 deletions

View file

@ -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},

View file

@ -1,3 +1,6 @@
#![warn(clippy::pedantic)]
#![allow(clippy::wildcard_imports)]
use color_eyre::Result;
mod game;

View file

@ -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,

View file

@ -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(())
}