From 4b71668742cc92fb252fd9b5bd92406c3a12d447 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Fri, 13 Oct 2023 08:22:05 +0800 Subject: [PATCH] refactor: remove unnecessary let binding --- app/src/app.rs | 2 +- app/src/input/input.rs | 2 +- core/src/input/input.rs | 2 +- core/src/select/select.rs | 2 +- core/src/tasks/scheduler.rs | 14 +++++++------- plugin/src/scope.rs | 2 +- shared/src/defer.rs | 2 +- shared/src/fs.rs | 2 +- shared/src/term/term.rs | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/src/app.rs b/app/src/app.rs index 74870fd1d..83968502b 100644 --- a/app/src/app.rs +++ b/app/src/app.rs @@ -75,7 +75,7 @@ impl App { fn dispatch_render(&mut self) { if let Some(term) = &mut self.term { - let _ = term.draw(|f| { + _ = term.draw(|f| { plugin::scope(&self.cx, |_| { f.render_widget(Root::new(&self.cx), f.size()); }); diff --git a/app/src/input/input.rs b/app/src/input/input.rs index ea26ed3ff..ccdc9f4c2 100644 --- a/app/src/input/input.rs +++ b/app/src/input/input.rs @@ -51,7 +51,7 @@ impl<'a> Widget for Input<'a> { ) } - let _ = match input.mode() { + _ = match input.mode() { InputMode::Insert => Term::set_cursor_bar(), _ => Term::set_cursor_block(), }; diff --git a/core/src/input/input.rs b/core/src/input/input.rs index 58964e621..143015eb5 100644 --- a/core/src/input/input.rs +++ b/core/src/input/input.rs @@ -45,7 +45,7 @@ impl Input { pub fn close(&mut self, submit: bool) -> bool { if let Some(cb) = self.callback.take() { let value = self.snap_mut().value.clone(); - let _ = cb.send(if submit { Ok(value) } else { Err(InputError::Canceled(value)) }); + _ = cb.send(if submit { Ok(value) } else { Err(InputError::Canceled(value)) }); } self.visible = false; diff --git a/core/src/select/select.rs b/core/src/select/select.rs index fbd180e6b..ed7762c70 100644 --- a/core/src/select/select.rs +++ b/core/src/select/select.rs @@ -31,7 +31,7 @@ impl Select { pub fn close(&mut self, submit: bool) -> bool { if let Some(cb) = self.callback.take() { - let _ = cb.send(if submit { Ok(self.cursor) } else { Err(anyhow!("canceled")) }); + _ = cb.send(if submit { Ok(self.cursor) } else { Err(anyhow!("canceled")) }); } self.cursor = 0; diff --git a/core/src/tasks/scheduler.rs b/core/src/tasks/scheduler.rs index 64d39fa10..3d4e650aa 100644 --- a/core/src/tasks/scheduler.rs +++ b/core/src/tasks/scheduler.rs @@ -192,7 +192,7 @@ impl Scheduler { }) }); - let _ = self.todo.send_blocking({ + _ = self.todo.send_blocking({ let file = self.file.clone(); async move { if !force { @@ -208,7 +208,7 @@ impl Scheduler { let name = format!("Copy {:?} to {:?}", from, to); let id = self.running.write().add(name); - let _ = self.todo.send_blocking({ + _ = self.todo.send_blocking({ let file = self.file.clone(); async move { if !force { @@ -224,7 +224,7 @@ impl Scheduler { let name = format!("Link {from:?} to {to:?}"); let id = self.running.write().add(name); - let _ = self.todo.send_blocking({ + _ = self.todo.send_blocking({ let file = self.file.clone(); async move { if !force { @@ -258,7 +258,7 @@ impl Scheduler { }) }); - let _ = self.todo.send_blocking({ + _ = self.todo.send_blocking({ let file = self.file.clone(); async move { file.delete(FileOpDelete { id, target, length: 0 }).await.ok(); @@ -271,7 +271,7 @@ impl Scheduler { let name = format!("Trash {:?}", target); let id = self.running.write().add(name); - let _ = self.todo.send_blocking({ + _ = self.todo.send_blocking({ let file = self.file.clone(); async move { file.trash(FileOpTrash { id, target, length: 0 }).await.ok(); @@ -337,7 +337,7 @@ impl Scheduler { } let id = running.add(format!("Calculate the size of {:?}", target)); - let _ = self.todo.send_blocking({ + _ = self.todo.send_blocking({ let precache = self.precache.clone(); let target = target.clone(); let throttle = throttle.clone(); @@ -353,7 +353,7 @@ impl Scheduler { let name = format!("Preload mimetype for {} files", targets.len()); let id = self.running.write().add(name); - let _ = self.todo.send_blocking({ + _ = self.todo.send_blocking({ let precache = self.precache.clone(); async move { precache.mime(PrecacheOpMime { id, targets }).await.ok(); diff --git a/plugin/src/scope.rs b/plugin/src/scope.rs index 34e9f37fc..8f34c35ac 100644 --- a/plugin/src/scope.rs +++ b/plugin/src/scope.rs @@ -5,7 +5,7 @@ pub use mlua::Scope; use crate::{bindings, GLOBALS, LUA}; pub fn scope<'a>(cx: &'a Ctx, f: impl FnOnce(&Scope<'a, 'a>)) { - let _ = LUA.scope(|scope| { + _ = LUA.scope(|scope| { let tbl = LUA.create_table()?; tbl.set("active", bindings::Active::new(scope, cx).make()?)?; tbl.set("tabs", bindings::Tabs::new(scope, cx.manager.tabs()).make()?)?; diff --git a/shared/src/defer.rs b/shared/src/defer.rs index d247eef15..ff86a57a4 100644 --- a/shared/src/defer.rs +++ b/shared/src/defer.rs @@ -7,7 +7,7 @@ impl T, T> Defer { impl T, T> Drop for Defer { fn drop(&mut self) { if let Some(f) = self.0.take() { - let _ = f(); + _ = f(); } } } diff --git a/shared/src/fs.rs b/shared/src/fs.rs index bd8c1a379..6554d9d07 100644 --- a/shared/src/fs.rs +++ b/shared/src/fs.rs @@ -43,7 +43,7 @@ pub fn copy_with_progress(from: &Path, to: &Path) -> mpsc::Receiver tick_tx.send(Ok(len)), Err(e) => tick_tx.send(Err(e)), }; diff --git a/shared/src/term/term.rs b/shared/src/term/term.rs index 6e6da0989..a37aa2078 100644 --- a/shared/src/term/term.rs +++ b/shared/src/term/term.rs @@ -35,7 +35,7 @@ impl Term { pub fn size() -> WindowSize { let mut size = WindowSize { rows: 0, columns: 0, width: 0, height: 0 }; if let Ok(s) = crossterm::terminal::window_size() { - let _ = mem::replace(&mut size, s); + _ = mem::replace(&mut size, s); } if size.rows == 0 || size.columns == 0 {