ran clippy fix

This commit is contained in:
2026-02-27 11:04:41 -05:00
parent c508180228
commit c559d1cc75
15 changed files with 44 additions and 69 deletions

View File

@@ -1,25 +1,22 @@
use std::{
collections::HashSet, env, fmt::Debug, os::unix::fs::PermissionsExt, path::PathBuf, sync::Arc,
collections::HashSet, fmt::Debug, path::PathBuf, sync::Arc,
};
use crate::{
builtin::{
BUILTINS,
complete::{CompFlags, CompOptFlags, CompOpts},
},
builtin::complete::{CompFlags, CompOptFlags, CompOpts},
libsh::{
error::{ShErr, ShErrKind, ShResult},
error::ShResult,
utils::TkVecUtils,
},
parse::{
execute::{VarCtxGuard, exec_input},
lex::{self, LexFlags, Tk, TkFlags, TkRule, ends_with_unescaped},
lex::{self, LexFlags, Tk, TkRule, ends_with_unescaped},
},
readline::{
Marker, annotate_input, annotate_input_recursive, get_insertions,
Marker, annotate_input_recursive,
markers::{self, is_marker},
},
state::{VarFlags, VarKind, read_jobs, read_logic, read_meta, read_vars, write_vars},
state::{VarFlags, VarKind, read_jobs, read_meta, read_vars, write_vars},
};
pub fn complete_jobs(start: &str) -> Vec<String> {

View File

@@ -1,16 +1,15 @@
use std::{
env,
os::unix::fs::PermissionsExt,
path::{Path, PathBuf},
};
use crate::{
libsh::term::{Style, StyleSet, Styled},
libsh::term::{Style, StyleSet},
readline::{
annotate_input,
markers::{self, is_marker},
},
state::{read_logic, read_meta, read_shopts},
state::{read_meta, read_shopts},
};
/// Syntax highlighter for shell input using Unicode marker-based annotation

View File

@@ -11,10 +11,7 @@ use super::vicmd::{
ViCmd, Word,
};
use crate::{
libsh::{
error::ShResult,
term::{Style, Styled},
},
libsh::error::ShResult,
parse::lex::{LexFlags, LexStream, Tk, TkFlags, TkRule},
prelude::*,
readline::{
@@ -950,7 +947,7 @@ impl LineBuf {
| TextObj::Angle(bound) => self.text_obj_delim(count, text_obj, bound),
// Other stuff
TextObj::Tag(bound) => todo!(),
TextObj::Tag(_bound) => todo!(),
TextObj::Custom(_) => todo!(),
}
}
@@ -1027,12 +1024,12 @@ impl LineBuf {
Some((start, end))
}
pub fn text_obj_paragraph(&mut self, count: usize, bound: Bound) -> Option<(usize, usize)> {
pub fn text_obj_paragraph(&mut self, _count: usize, _bound: Bound) -> Option<(usize, usize)> {
todo!()
}
pub fn text_obj_delim(
&mut self,
count: usize,
_count: usize,
text_obj: TextObj,
bound: Bound,
) -> Option<(usize, usize)> {
@@ -1149,7 +1146,7 @@ impl LineBuf {
}
pub fn text_obj_quote(
&mut self,
count: usize,
_count: usize,
text_obj: TextObj,
bound: Bound,
) -> Option<(usize, usize)> {
@@ -2285,14 +2282,14 @@ impl LineBuf {
MotionKind::On(target_pos)
}
MotionCmd(count, Motion::ScreenLineUp) => todo!(),
MotionCmd(count, Motion::ScreenLineUpCharwise) => todo!(),
MotionCmd(count, Motion::ScreenLineDown) => todo!(),
MotionCmd(count, Motion::ScreenLineDownCharwise) => todo!(),
MotionCmd(count, Motion::BeginningOfScreenLine) => todo!(),
MotionCmd(count, Motion::FirstGraphicalOnScreenLine) => todo!(),
MotionCmd(count, Motion::HalfOfScreen) => todo!(),
MotionCmd(count, Motion::HalfOfScreenLineText) => todo!(),
MotionCmd(_count, Motion::ScreenLineUp) => todo!(),
MotionCmd(_count, Motion::ScreenLineUpCharwise) => todo!(),
MotionCmd(_count, Motion::ScreenLineDown) => todo!(),
MotionCmd(_count, Motion::ScreenLineDownCharwise) => todo!(),
MotionCmd(_count, Motion::BeginningOfScreenLine) => todo!(),
MotionCmd(_count, Motion::FirstGraphicalOnScreenLine) => todo!(),
MotionCmd(_count, Motion::HalfOfScreen) => todo!(),
MotionCmd(_count, Motion::HalfOfScreenLineText) => todo!(),
MotionCmd(_count, Motion::WholeBuffer) => {
MotionKind::Exclusive((0, self.grapheme_indices().len()))
}
@@ -2314,9 +2311,9 @@ impl LineBuf {
final_end = final_end.min(self.cursor.max);
MotionKind::Exclusive((start, final_end))
}
MotionCmd(count, Motion::RepeatMotion) => todo!(),
MotionCmd(count, Motion::RepeatMotionRev) => todo!(),
MotionCmd(count, Motion::Null) => MotionKind::Null,
MotionCmd(_count, Motion::RepeatMotion) => todo!(),
MotionCmd(_count, Motion::RepeatMotionRev) => todo!(),
MotionCmd(_count, Motion::Null) => MotionKind::Null,
};
self.set_buffer(buffer);
@@ -2380,7 +2377,7 @@ impl LineBuf {
end = self.cursor.get();
}
},
SelectMode::Block(anchor) => todo!(),
SelectMode::Block(_anchor) => todo!(),
}
if start >= end {
mode.invert_anchor();
@@ -2490,7 +2487,7 @@ impl LineBuf {
match verb {
Verb::Delete | Verb::Yank | Verb::Change => {
log::debug!("Executing verb: {verb:?} with motion: {motion:?}");
let Some((mut start, mut end)) = self.range_from_motion(&motion) else {
let Some((start, end)) = self.range_from_motion(&motion) else {
log::debug!("No range from motion, nothing to do");
return Ok(());
};

View File

@@ -1,7 +1,6 @@
use history::History;
use keys::{KeyCode, KeyEvent, ModKeys};
use linebuf::{LineBuf, SelectAnchor, SelectMode};
use nix::libc::STDOUT_FILENO;
use term::{KeyReader, Layout, LineWriter, PollReader, TermWriter, get_win_size};
use unicode_width::UnicodeWidthStr;
use vicmd::{CmdFlags, Motion, MotionCmd, RegisterName, Verb, VerbCmd, ViCmd};
@@ -14,10 +13,7 @@ use crate::prelude::*;
use crate::readline::term::{Pos, calc_str_width};
use crate::state::read_shopts;
use crate::{
libsh::{
error::ShResult,
term::{Style, Styled},
},
libsh::error::ShResult,
parse::lex::{self, LexFlags, Tk, TkFlags, TkRule},
readline::{complete::Completer, highlight::Highlighter},
};

View File

@@ -8,7 +8,7 @@ use std::{
use nix::{
errno::Errno,
libc::{self, STDIN_FILENO},
libc::{self},
poll::{self, PollFlags, PollTimeout},
sys::termios::{self, tcgetattr, tcsetattr},
unistd::isatty,
@@ -23,16 +23,14 @@ use crate::{
sys::TTY_FILENO,
},
readline::keys::{KeyCode, ModKeys},
shopt::ShedBellStyle,
state::read_shopts,
};
use crate::{
prelude::*,
procio::borrow_fd,
state::{read_meta, write_meta},
};
use super::{keys::KeyEvent, linebuf::LineBuf};
use super::keys::KeyEvent;
pub fn raw_mode() -> RawModeGuard {
let orig = termios::tcgetattr(unsafe { BorrowedFd::borrow_raw(*TTY_FILENO) })
@@ -50,7 +48,7 @@ pub fn raw_mode() -> RawModeGuard {
)
.expect("Failed to set terminal to raw mode");
let (cols, rows) = get_win_size(*TTY_FILENO);
let (_cols, _rows) = get_win_size(*TTY_FILENO);
RawModeGuard {
orig,

View File

@@ -9,7 +9,6 @@ use super::vicmd::{
Anchor, Bound, CmdFlags, Dest, Direction, Motion, MotionCmd, RegisterName, TextObj, To, Verb,
VerbCmd, ViCmd, Word,
};
use crate::prelude::*;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ModeReport {
@@ -995,7 +994,7 @@ impl ViNormal {
}
};
if chars.peek().is_some() {}
chars.peek().is_some();
let verb_ref = verb.as_ref().map(|v| &v.1);
let motion_ref = motion.as_ref().map(|m| &m.1);
@@ -1660,7 +1659,7 @@ impl ViVisual {
}
};
if chars.peek().is_some() {}
chars.peek().is_some();
let verb_ref = verb.as_ref().map(|v| &v.1);
let motion_ref = motion.as_ref().map(|m| &m.1);