refactor: remove unnecessary let binding

This commit is contained in:
sxyazi 2023-10-13 08:22:05 +08:00
parent d032b6850d
commit 4b71668742
No known key found for this signature in database
9 changed files with 15 additions and 15 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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()?)?;

View File

@ -7,7 +7,7 @@ impl<F: FnOnce() -> T, T> Defer<F, T> {
impl<F: FnOnce() -> T, T> Drop for Defer<F, T> {
fn drop(&mut self) {
if let Some(f) = self.0.take() {
let _ = f();
_ = f();
}
}
}

View File

@ -43,7 +43,7 @@ pub fn copy_with_progress(from: &Path, to: &Path) -> mpsc::Receiver<Result<u64,
let (from, to) = (from.to_path_buf(), to.to_path_buf());
async move {
let _ = match fs::copy(from, to).await {
_ = match fs::copy(from, to).await {
Ok(len) => tick_tx.send(Ok(len)),
Err(e) => tick_tx.send(Err(e)),
};

View File

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