mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
refactor: remove unnecessary let binding
This commit is contained in:
parent
d032b6850d
commit
4b71668742
9 changed files with 15 additions and 15 deletions
|
|
@ -75,7 +75,7 @@ impl App {
|
||||||
|
|
||||||
fn dispatch_render(&mut self) {
|
fn dispatch_render(&mut self) {
|
||||||
if let Some(term) = &mut self.term {
|
if let Some(term) = &mut self.term {
|
||||||
let _ = term.draw(|f| {
|
_ = term.draw(|f| {
|
||||||
plugin::scope(&self.cx, |_| {
|
plugin::scope(&self.cx, |_| {
|
||||||
f.render_widget(Root::new(&self.cx), f.size());
|
f.render_widget(Root::new(&self.cx), f.size());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ impl<'a> Widget for Input<'a> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = match input.mode() {
|
_ = match input.mode() {
|
||||||
InputMode::Insert => Term::set_cursor_bar(),
|
InputMode::Insert => Term::set_cursor_bar(),
|
||||||
_ => Term::set_cursor_block(),
|
_ => Term::set_cursor_block(),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ impl Input {
|
||||||
pub fn close(&mut self, submit: bool) -> bool {
|
pub fn close(&mut self, submit: bool) -> bool {
|
||||||
if let Some(cb) = self.callback.take() {
|
if let Some(cb) = self.callback.take() {
|
||||||
let value = self.snap_mut().value.clone();
|
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;
|
self.visible = false;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ impl Select {
|
||||||
|
|
||||||
pub fn close(&mut self, submit: bool) -> bool {
|
pub fn close(&mut self, submit: bool) -> bool {
|
||||||
if let Some(cb) = self.callback.take() {
|
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;
|
self.cursor = 0;
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ impl Scheduler {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
let _ = self.todo.send_blocking({
|
_ = self.todo.send_blocking({
|
||||||
let file = self.file.clone();
|
let file = self.file.clone();
|
||||||
async move {
|
async move {
|
||||||
if !force {
|
if !force {
|
||||||
|
|
@ -208,7 +208,7 @@ impl Scheduler {
|
||||||
let name = format!("Copy {:?} to {:?}", from, to);
|
let name = format!("Copy {:?} to {:?}", from, to);
|
||||||
let id = self.running.write().add(name);
|
let id = self.running.write().add(name);
|
||||||
|
|
||||||
let _ = self.todo.send_blocking({
|
_ = self.todo.send_blocking({
|
||||||
let file = self.file.clone();
|
let file = self.file.clone();
|
||||||
async move {
|
async move {
|
||||||
if !force {
|
if !force {
|
||||||
|
|
@ -224,7 +224,7 @@ impl Scheduler {
|
||||||
let name = format!("Link {from:?} to {to:?}");
|
let name = format!("Link {from:?} to {to:?}");
|
||||||
let id = self.running.write().add(name);
|
let id = self.running.write().add(name);
|
||||||
|
|
||||||
let _ = self.todo.send_blocking({
|
_ = self.todo.send_blocking({
|
||||||
let file = self.file.clone();
|
let file = self.file.clone();
|
||||||
async move {
|
async move {
|
||||||
if !force {
|
if !force {
|
||||||
|
|
@ -258,7 +258,7 @@ impl Scheduler {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
let _ = self.todo.send_blocking({
|
_ = self.todo.send_blocking({
|
||||||
let file = self.file.clone();
|
let file = self.file.clone();
|
||||||
async move {
|
async move {
|
||||||
file.delete(FileOpDelete { id, target, length: 0 }).await.ok();
|
file.delete(FileOpDelete { id, target, length: 0 }).await.ok();
|
||||||
|
|
@ -271,7 +271,7 @@ impl Scheduler {
|
||||||
let name = format!("Trash {:?}", target);
|
let name = format!("Trash {:?}", target);
|
||||||
let id = self.running.write().add(name);
|
let id = self.running.write().add(name);
|
||||||
|
|
||||||
let _ = self.todo.send_blocking({
|
_ = self.todo.send_blocking({
|
||||||
let file = self.file.clone();
|
let file = self.file.clone();
|
||||||
async move {
|
async move {
|
||||||
file.trash(FileOpTrash { id, target, length: 0 }).await.ok();
|
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 id = running.add(format!("Calculate the size of {:?}", target));
|
||||||
let _ = self.todo.send_blocking({
|
_ = self.todo.send_blocking({
|
||||||
let precache = self.precache.clone();
|
let precache = self.precache.clone();
|
||||||
let target = target.clone();
|
let target = target.clone();
|
||||||
let throttle = throttle.clone();
|
let throttle = throttle.clone();
|
||||||
|
|
@ -353,7 +353,7 @@ impl Scheduler {
|
||||||
let name = format!("Preload mimetype for {} files", targets.len());
|
let name = format!("Preload mimetype for {} files", targets.len());
|
||||||
let id = self.running.write().add(name);
|
let id = self.running.write().add(name);
|
||||||
|
|
||||||
let _ = self.todo.send_blocking({
|
_ = self.todo.send_blocking({
|
||||||
let precache = self.precache.clone();
|
let precache = self.precache.clone();
|
||||||
async move {
|
async move {
|
||||||
precache.mime(PrecacheOpMime { id, targets }).await.ok();
|
precache.mime(PrecacheOpMime { id, targets }).await.ok();
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ pub use mlua::Scope;
|
||||||
use crate::{bindings, GLOBALS, LUA};
|
use crate::{bindings, GLOBALS, LUA};
|
||||||
|
|
||||||
pub fn scope<'a>(cx: &'a Ctx, f: impl FnOnce(&Scope<'a, 'a>)) {
|
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()?;
|
let tbl = LUA.create_table()?;
|
||||||
tbl.set("active", bindings::Active::new(scope, cx).make()?)?;
|
tbl.set("active", bindings::Active::new(scope, cx).make()?)?;
|
||||||
tbl.set("tabs", bindings::Tabs::new(scope, cx.manager.tabs()).make()?)?;
|
tbl.set("tabs", bindings::Tabs::new(scope, cx.manager.tabs()).make()?)?;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ impl<F: FnOnce() -> T, T> Defer<F, T> {
|
||||||
impl<F: FnOnce() -> T, T> Drop for Defer<F, T> {
|
impl<F: FnOnce() -> T, T> Drop for Defer<F, T> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(f) = self.0.take() {
|
if let Some(f) = self.0.take() {
|
||||||
let _ = f();
|
_ = f();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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());
|
let (from, to) = (from.to_path_buf(), to.to_path_buf());
|
||||||
|
|
||||||
async move {
|
async move {
|
||||||
let _ = match fs::copy(from, to).await {
|
_ = match fs::copy(from, to).await {
|
||||||
Ok(len) => tick_tx.send(Ok(len)),
|
Ok(len) => tick_tx.send(Ok(len)),
|
||||||
Err(e) => tick_tx.send(Err(e)),
|
Err(e) => tick_tx.send(Err(e)),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ impl Term {
|
||||||
pub fn size() -> WindowSize {
|
pub fn size() -> WindowSize {
|
||||||
let mut size = WindowSize { rows: 0, columns: 0, width: 0, height: 0 };
|
let mut size = WindowSize { rows: 0, columns: 0, width: 0, height: 0 };
|
||||||
if let Ok(s) = crossterm::terminal::window_size() {
|
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 {
|
if size.rows == 0 || size.columns == 0 {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue