Fix all clippy warnings across workspace

collapsible_if, let-chains, derivable_impls, clone_on_copy, useless_vec, approx_constant, io_other_error, single_match, collapsible_match, unnecessary_map_or, manual_is_multiple_of, result_large_err, too_many_arguments, upper_case_acronyms

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-06-12 21:09:47 +08:00
parent ab1c5882d1
commit a2c7c0fa71
16 changed files with 82 additions and 131 deletions

View File

@@ -716,6 +716,7 @@ impl App {
}
}
#[allow(clippy::result_large_err)]
fn submit_session_form(&mut self, form: SessionForm) -> Result<(), (SessionForm, String)> {
let config = match build_session_config(&form) {
Ok(config) => config,
@@ -741,17 +742,13 @@ impl App {
fn on_normal_key(&mut self, code: KeyCode, modifiers: KeyModifiers) {
match code {
KeyCode::Char('q') => self.should_quit = true,
KeyCode::Char('j') => {
if self.active + 1 < self.tabs.len() {
self.active += 1;
self.persist_state();
}
KeyCode::Char('j') if self.active + 1 < self.tabs.len() => {
self.active += 1;
self.persist_state();
}
KeyCode::Char('k') => {
if self.active > 0 {
self.active -= 1;
self.persist_state();
}
KeyCode::Char('k') if self.active > 0 => {
self.active -= 1;
self.persist_state();
}
KeyCode::Char('n') => self.open_create_form(),
KeyCode::Char('e') => self.open_edit_form(),
@@ -854,11 +851,11 @@ impl App {
}
KeyCode::Enter => {
let mode = std::mem::replace(&mut self.mode, AppMode::Normal);
if let AppMode::SessionForm(form) = mode {
if let Err((form, err)) = self.submit_session_form(form) {
self.mode = AppMode::SessionForm(form);
self.set_notice(err);
}
if let AppMode::SessionForm(form) = mode
&& let Err((form, err)) = self.submit_session_form(form)
{
self.mode = AppMode::SessionForm(form);
self.set_notice(err);
}
}
_ => {}
@@ -879,12 +876,11 @@ pub fn run(terminal: &mut DefaultTerminal, mut app: App) -> io::Result<()> {
app.drain_events();
terminal.draw(|frame| crate::ui::render(frame, &app))?;
if event::poll(Duration::from_millis(100))? {
if let Event::Key(key) = event::read()? {
if key.kind == KeyEventKind::Press {
app.on_key(key.code, key.modifiers);
}
}
if event::poll(Duration::from_millis(100))?
&& let Event::Key(key) = event::read()?
&& key.kind == KeyEventKind::Press
{
app.on_key(key.code, key.modifiers);
}
if app.should_quit() {

View File

@@ -91,10 +91,7 @@ fn render_main(frame: &mut Frame, app: &App, area: Rect) {
sections[3],
);
if matches!(tab.status, ConnectionStatus::Error(_)) {
if let ConnectionStatus::Error(message) = &tab.status {
let _ = message;
}
if let ConnectionStatus::Error(_) = &tab.status {
}
} else {
frame.render_widget(