Skip to content

Commit

Permalink
🚨 Fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
harehare committed Dec 2, 2024
1 parent 9661bf4 commit 14b13b6
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
ui::{self, Confirm, Help, Icon, Input, InputList, SelectCondition, Theme},
};
use anyhow::{anyhow, Result};
use crossterm::event::{self, Event, KeyCode, KeyEvent, KeyModifiers};
use ratatui::crossterm::event::{self, Event, KeyCode, KeyEvent, KeyModifiers};
use ratatui::{
layout::{Alignment, Constraint, Layout, Rect},
widgets::{Block, Gauge, Padding, Paragraph},
Expand Down
6 changes: 5 additions & 1 deletion src/models/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ impl Search {
None
} else {
let before = if let Some(before) = config.before_context {
let start = if index < before { 0 } else { index - before };
let start = if index < before {
0
} else {
index.saturating_sub(before)
};
slice[start..index]
.iter()
.enumerate()
Expand Down
2 changes: 1 addition & 1 deletion src/ui/confirm.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::Theme;
use crate::ui;
use anyhow::Result;
use crossterm::event::{Event, KeyCode, KeyEvent};
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent};
use ratatui::{
layout::{Constraint, Layout, Rect},
widgets::{Block, Clear, Padding, Paragraph},
Expand Down
2 changes: 1 addition & 1 deletion src/ui/input.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::Theme;
use crate::{models, ui};
use crossterm::event::{Event, KeyCode, KeyEvent};
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent};
use ratatui::{
layout::Rect,
widgets::{Block, Padding, Paragraph},
Expand Down
2 changes: 1 addition & 1 deletion src/ui/input_list.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::{Icon, Input, MatchColors, Theme};
use crate::{models::SearchCondition, ui};
use crossterm::event::{Event, KeyCode, KeyEvent};
use itertools::Itertools;
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent};
use ratatui::{
layout::{Constraint, Layout, Rect},
style::{Modifier, Style},
Expand Down
2 changes: 1 addition & 1 deletion src/ui/search_condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'a> SearchCondition<'a> {
}
}

impl<'a> Display for SearchCondition<'a> {
impl Display for SearchCondition<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
let s = match &self.condition {
models::SearchCondition::Exact(s) => format!("{} {}", self.icon.search(), s),
Expand Down
2 changes: 1 addition & 1 deletion src/ui/search_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use super::{MatchColors, Theme};
use crate::models::file_result::LineResult;
use crate::models::{self, MatchResult, SearchResultConfig};
use crate::ui;
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use nom::ToUsize;
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use ratatui::style::{Modifier, Style};
use ratatui::widgets::{Block, Padding, Paragraph};
use ratatui::{
Expand Down
2 changes: 1 addition & 1 deletion src/ui/select_contidion.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{models::SearchCondition, ui};
use crossterm::event::{Event, KeyCode, KeyEvent};
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent};
use ratatui::{
layout::{Constraint, Layout, Rect},
text::{Line, Span},
Expand Down

0 comments on commit 14b13b6

Please sign in to comment.