Skip to content

Commit

Permalink
refactor: remove unnecessary let binding
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Oct 13, 2023
1 parent d032b68 commit 4b71668
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
Expand Down
2 changes: 1 addition & 1 deletion app/src/input/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
Expand Down
2 changes: 1 addition & 1 deletion core/src/input/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion core/src/select/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions core/src/tasks/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl Scheduler {
})
});

let _ = self.todo.send_blocking({
_ = self.todo.send_blocking({
let file = self.file.clone();
async move {
if !force {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?)?;
Expand Down
2 changes: 1 addition & 1 deletion shared/src/defer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
2 changes: 1 addition & 1 deletion shared/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
};
Expand Down
2 changes: 1 addition & 1 deletion shared/src/term/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4b71668

Please sign in to comment.