From 94405bb61722142e8c4d90bb5f31038fc9aa5f72 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 20 Mar 2019 18:55:52 -0400 Subject: [PATCH] Fix clippy errors and upgrade Rust to 1.33.0 in CI (#1945) --- .appveyor.yml | 2 +- .travis.yml | 10 +- cli/cli_behavior.rs | 2 +- cli/compiler.rs | 7 +- cli/deno_dir.rs | 2 +- cli/global_timer.rs | 1 + cli/ops.rs | 221 +++++++++++++++++++++----------------------- cli/permissions.rs | 27 +++--- cli/resources.rs | 13 ++- 9 files changed, 135 insertions(+), 150 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index e81800424b..70d26f773f 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -154,7 +154,7 @@ install: Invoke-WebRequest -Uri "https://win.rustup.rs" ` -OutFile "$env:TEMP\rustup-init.exe" Exec -NoNewLines { - & "$env:TEMP\rustup-init.exe" -y --default-toolchain 1.31.1 + & "$env:TEMP\rustup-init.exe" -y --default-toolchain 1.33.0 } Delete-Tree @( "$env:RUSTUP_HOME\downloads", diff --git a/.travis.yml b/.travis.yml index df7aab214f..2e5991d93a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ git: depth: 1 env: global: + - RUST_VERSION=1.33.0 - CARGO_HOME=$TRAVIS_BUILD_DIR/third_party/rust_crates/ - RUSTUP_HOME=$HOME/.rustup/ - RUST_BACKTRACE=full @@ -37,11 +38,10 @@ install: - node -v - |- # Install Rust. - # TODO(ry) Include rustc in third_party. - # https://github.com/denoland/deno/issues/386 - if [ ! $(rustc --version | grep 1.31.1) ]; then - curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.31.1 - rustup default 1.31.1 + if [ ! $(rustc --version | grep $RUST_VERSION) ]; then + curl -sSf https://sh.rustup.rs | sh -s -- -y \ + --default-toolchain $RUST_VERSION + rustup default $RUST_VERSION fi rustc --version cargo --version diff --git a/cli/cli_behavior.rs b/cli/cli_behavior.rs index f1bd5a5558..a297bdef90 100644 --- a/cli/cli_behavior.rs +++ b/cli/cli_behavior.rs @@ -52,6 +52,6 @@ impl Behavior for CliBehavior { control: &[u8], zero_copy: deno_buf, ) -> (bool, Box) { - ops::dispatch_all(Box::new(self), control, zero_copy, ops::op_selector_std) + ops::dispatch_all(self, control, zero_copy, ops::op_selector_std) } } diff --git a/cli/compiler.rs b/cli/compiler.rs index 17006b2b92..e90a10c168 100644 --- a/cli/compiler.rs +++ b/cli/compiler.rs @@ -60,12 +60,7 @@ impl Behavior for CompilerBehavior { control: &[u8], zero_copy: deno_buf, ) -> (bool, Box) { - ops::dispatch_all( - Box::new(self), - control, - zero_copy, - ops::op_selector_compiler, - ) + ops::dispatch_all(self, control, zero_copy, ops::op_selector_compiler) } } diff --git a/cli/deno_dir.rs b/cli/deno_dir.rs index 65656d7dd9..40612e9703 100644 --- a/cli/deno_dir.rs +++ b/cli/deno_dir.rs @@ -256,7 +256,7 @@ impl DenoDir { } }; - if out.source_code.starts_with("#!".as_bytes()) { + if out.source_code.starts_with(b"#!") { out.source_code = filter_shebang(out.source_code); } diff --git a/cli/global_timer.rs b/cli/global_timer.rs index eef70ddc20..d3ca52f460 100644 --- a/cli/global_timer.rs +++ b/cli/global_timer.rs @@ -14,6 +14,7 @@ use std::time::Instant; use tokio::sync::oneshot; use tokio::timer::Delay; +#[derive(Default)] pub struct GlobalTimer { tx: Option>, } diff --git a/cli/ops.rs b/cli/ops.rs index 826f6b1ccf..6d0acef043 100644 --- a/cli/ops.rs +++ b/cli/ops.rs @@ -2,7 +2,7 @@ use atty; use crate::ansi; use crate::errors; -use crate::errors::{op_not_implemented, DenoError, DenoResult, ErrorKind}; +use crate::errors::{DenoError, DenoResult, ErrorKind}; use crate::fs as deno_fs; use crate::http_util; use crate::isolate_state::{IsolateState, IsolateStateContainer}; @@ -58,10 +58,10 @@ pub type OpWithError = dyn Future + Send; // TODO Ideally we wouldn't have to box the OpWithError being returned. // The box is just to make it easier to get a prototype refactor working. type OpCreator = - fn(sc: Box<&IsolateStateContainer>, base: &msg::Base<'_>, data: deno_buf) + fn(sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf) -> Box; -type OpSelector = fn(inner_type: msg::Any) -> DenoResult>; +type OpSelector = fn(inner_type: msg::Any) -> Option; #[inline] fn empty_buf() -> Buf { @@ -73,7 +73,7 @@ fn empty_buf() -> Buf { /// control corresponds to the first argument of libdeno.send(). /// data corresponds to the second argument of libdeno.send(). pub fn dispatch_all( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, control: &[u8], zero_copy: deno_buf, op_selector: OpSelector, @@ -85,12 +85,9 @@ pub fn dispatch_all( let inner_type = base.inner_type(); let cmd_id = base.cmd_id(); - let op_func: Box = match op_selector(inner_type) { - Ok(v) => v, - Err(_) => panic!(format!( - "Unhandled message {}", - msg::enum_name_any(inner_type) - )), + let op_func: OpCreator = match op_selector(inner_type) { + Some(v) => v, + None => panic!("Unhandled message {}", msg::enum_name_any(inner_type)), }; let state = sc.state().clone(); @@ -144,72 +141,65 @@ pub fn dispatch_all( (base.sync(), boxed_op) } -pub fn op_selector_compiler( - inner_type: msg::Any, -) -> DenoResult> { - let op_creator: Box = match inner_type { - msg::Any::FetchModuleMetaData => Box::new(op_fetch_module_meta_data), - _ => match op_selector_std(inner_type) { - Ok(v) => v, - Err(e) => return Err(e), - }, - }; - Ok(op_creator) +pub fn op_selector_compiler(inner_type: msg::Any) -> Option { + match inner_type { + msg::Any::FetchModuleMetaData => Some(op_fetch_module_meta_data), + _ => op_selector_std(inner_type), + } } -pub fn op_selector_std(inner_type: msg::Any) -> DenoResult> { - let op_creator: OpCreator = match inner_type { - msg::Any::Accept => op_accept, - msg::Any::Chdir => op_chdir, - msg::Any::Chmod => op_chmod, - msg::Any::Close => op_close, - msg::Any::CopyFile => op_copy_file, - msg::Any::Cwd => op_cwd, - msg::Any::Dial => op_dial, - msg::Any::Environ => op_env, - msg::Any::Exit => op_exit, - msg::Any::Fetch => op_fetch, - msg::Any::FormatError => op_format_error, - msg::Any::GlobalTimer => op_global_timer, - msg::Any::GlobalTimerStop => op_global_timer_stop, - msg::Any::IsTTY => op_is_tty, - msg::Any::Listen => op_listen, - msg::Any::MakeTempDir => op_make_temp_dir, - msg::Any::Metrics => op_metrics, - msg::Any::Mkdir => op_mkdir, - msg::Any::Now => op_now, - msg::Any::Open => op_open, - msg::Any::PermissionRevoke => op_revoke_permission, - msg::Any::Permissions => op_permissions, - msg::Any::Read => op_read, - msg::Any::ReadDir => op_read_dir, - msg::Any::ReadFile => op_read_file, - msg::Any::Readlink => op_read_link, - msg::Any::Remove => op_remove, - msg::Any::Rename => op_rename, - msg::Any::ReplReadline => op_repl_readline, - msg::Any::ReplStart => op_repl_start, - msg::Any::Resources => op_resources, - msg::Any::Run => op_run, - msg::Any::RunStatus => op_run_status, - msg::Any::Seek => op_seek, - msg::Any::SetEnv => op_set_env, - msg::Any::Shutdown => op_shutdown, - msg::Any::Start => op_start, - msg::Any::Stat => op_stat, - msg::Any::Symlink => op_symlink, - msg::Any::Truncate => op_truncate, - msg::Any::WorkerGetMessage => op_worker_get_message, - msg::Any::WorkerPostMessage => op_worker_post_message, - msg::Any::Write => op_write, - msg::Any::WriteFile => op_write_file, - _ => return Err(op_not_implemented()), - }; - Ok(Box::new(op_creator)) +pub fn op_selector_std(inner_type: msg::Any) -> Option { + match inner_type { + msg::Any::Accept => Some(op_accept), + msg::Any::Chdir => Some(op_chdir), + msg::Any::Chmod => Some(op_chmod), + msg::Any::Close => Some(op_close), + msg::Any::CopyFile => Some(op_copy_file), + msg::Any::Cwd => Some(op_cwd), + msg::Any::Dial => Some(op_dial), + msg::Any::Environ => Some(op_env), + msg::Any::Exit => Some(op_exit), + msg::Any::Fetch => Some(op_fetch), + msg::Any::FormatError => Some(op_format_error), + msg::Any::GlobalTimer => Some(op_global_timer), + msg::Any::GlobalTimerStop => Some(op_global_timer_stop), + msg::Any::IsTTY => Some(op_is_tty), + msg::Any::Listen => Some(op_listen), + msg::Any::MakeTempDir => Some(op_make_temp_dir), + msg::Any::Metrics => Some(op_metrics), + msg::Any::Mkdir => Some(op_mkdir), + msg::Any::Now => Some(op_now), + msg::Any::Open => Some(op_open), + msg::Any::PermissionRevoke => Some(op_revoke_permission), + msg::Any::Permissions => Some(op_permissions), + msg::Any::Read => Some(op_read), + msg::Any::ReadDir => Some(op_read_dir), + msg::Any::ReadFile => Some(op_read_file), + msg::Any::Readlink => Some(op_read_link), + msg::Any::Remove => Some(op_remove), + msg::Any::Rename => Some(op_rename), + msg::Any::ReplReadline => Some(op_repl_readline), + msg::Any::ReplStart => Some(op_repl_start), + msg::Any::Resources => Some(op_resources), + msg::Any::Run => Some(op_run), + msg::Any::RunStatus => Some(op_run_status), + msg::Any::Seek => Some(op_seek), + msg::Any::SetEnv => Some(op_set_env), + msg::Any::Shutdown => Some(op_shutdown), + msg::Any::Start => Some(op_start), + msg::Any::Stat => Some(op_stat), + msg::Any::Symlink => Some(op_symlink), + msg::Any::Truncate => Some(op_truncate), + msg::Any::WorkerGetMessage => Some(op_worker_get_message), + msg::Any::WorkerPostMessage => Some(op_worker_post_message), + msg::Any::Write => Some(op_write), + msg::Any::WriteFile => Some(op_write_file), + _ => None, + } } fn op_now( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -233,7 +223,7 @@ fn op_now( } fn op_is_tty( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, _data: deno_buf, ) -> Box { @@ -258,7 +248,7 @@ fn op_is_tty( } fn op_exit( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, _data: deno_buf, ) -> Box { @@ -267,7 +257,7 @@ fn op_exit( } fn op_start( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -323,7 +313,7 @@ fn op_start( } fn op_format_error( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -342,7 +332,6 @@ fn op_format_error( &mut builder, &msg::FormatErrorResArgs { error: Some(new_error), - ..Default::default() }, ); @@ -383,7 +372,7 @@ pub fn odd_future(err: DenoError) -> Box { // https://github.com/denoland/deno/blob/golang/os.go#L100-L154 fn op_fetch_module_meta_data( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -423,7 +412,7 @@ fn op_fetch_module_meta_data( } fn op_chdir( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -437,7 +426,7 @@ fn op_chdir( } fn op_global_timer_stop( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -450,7 +439,7 @@ fn op_global_timer_stop( } fn op_global_timer( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -483,7 +472,7 @@ fn op_global_timer( } fn op_set_env( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -499,7 +488,7 @@ fn op_set_env( } fn op_env( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -531,7 +520,7 @@ fn op_env( } fn op_permissions( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -560,7 +549,7 @@ fn op_permissions( } fn op_revoke_permission( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -582,7 +571,7 @@ fn op_revoke_permission( } fn op_fetch( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -669,7 +658,7 @@ where } fn op_make_temp_dir( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -718,7 +707,7 @@ fn op_make_temp_dir( } fn op_mkdir( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -740,7 +729,7 @@ fn op_mkdir( } fn op_chmod( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -779,7 +768,7 @@ fn op_chmod( } fn op_open( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -869,7 +858,7 @@ fn op_open( } fn op_close( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -886,7 +875,7 @@ fn op_close( } fn op_shutdown( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -912,7 +901,7 @@ fn op_shutdown( } fn op_read( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -950,7 +939,7 @@ fn op_read( } fn op_write( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -987,7 +976,7 @@ fn op_write( } fn op_seek( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1009,7 +998,7 @@ fn op_seek( } fn op_remove( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1039,7 +1028,7 @@ fn op_remove( // Prototype https://github.com/denoland/deno/blob/golang/os.go#L171-L184 fn op_read_file( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1077,7 +1066,7 @@ fn op_read_file( } fn op_copy_file( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1133,7 +1122,7 @@ fn get_mode(_perm: &fs::Permissions) -> u32 { } fn op_cwd( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1159,7 +1148,7 @@ fn op_cwd( } fn op_stat( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1211,7 +1200,7 @@ fn op_stat( } fn op_read_dir( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1272,7 +1261,7 @@ fn op_read_dir( } fn op_write_file( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1302,7 +1291,7 @@ fn op_write_file( } fn op_rename( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1322,7 +1311,7 @@ fn op_rename( } fn op_symlink( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1351,7 +1340,7 @@ fn op_symlink( } fn op_read_link( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1389,7 +1378,7 @@ fn op_read_link( } fn op_repl_start( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1420,7 +1409,7 @@ fn op_repl_start( } fn op_repl_readline( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1456,7 +1445,7 @@ fn op_repl_readline( } fn op_truncate( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1479,7 +1468,7 @@ fn op_truncate( } fn op_listen( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1541,7 +1530,7 @@ fn new_conn(cmd_id: u32, tcp_stream: TcpStream) -> OpResult { } fn op_accept( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1567,7 +1556,7 @@ fn op_accept( } fn op_dial( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1593,7 +1582,7 @@ fn op_dial( } fn op_metrics( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1617,7 +1606,7 @@ fn op_metrics( } fn op_resources( - _sc: Box<&IsolateStateContainer>, + _sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1669,7 +1658,7 @@ fn subprocess_stdio_map(v: msg::ProcessStdio) -> std::process::Stdio { } fn op_run( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1742,7 +1731,7 @@ fn op_run( } fn op_run_status( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1818,7 +1807,7 @@ impl Future for GetMessageFuture { } fn op_worker_get_message( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { @@ -1852,7 +1841,7 @@ fn op_worker_get_message( } fn op_worker_post_message( - sc: Box<&IsolateStateContainer>, + sc: &IsolateStateContainer, base: &msg::Base<'_>, data: deno_buf, ) -> Box { diff --git a/cli/permissions.rs b/cli/permissions.rs index 9093c14f06..2240d94c1a 100644 --- a/cli/permissions.rs +++ b/cli/permissions.rs @@ -31,9 +31,10 @@ impl From for PermissionAccessorState { impl From for PermissionAccessorState { fn from(val: bool) -> Self { - match val { - true => PermissionAccessorState::Allow, - false => PermissionAccessorState::Ask, + if val { + PermissionAccessorState::Allow + } else { + PermissionAccessorState::Ask } } } @@ -243,48 +244,48 @@ impl DenoPermissions { } pub fn allows_run(&self) -> bool { - return self.allow_run.is_allow(); + self.allow_run.is_allow() } pub fn allows_read(&self) -> bool { - return self.allow_read.is_allow(); + self.allow_read.is_allow() } pub fn allows_write(&self) -> bool { - return self.allow_write.is_allow(); + self.allow_write.is_allow() } pub fn allows_net(&self) -> bool { - return self.allow_net.is_allow(); + self.allow_net.is_allow() } pub fn allows_env(&self) -> bool { - return self.allow_env.is_allow(); + self.allow_env.is_allow() } pub fn revoke_run(&self) -> DenoResult<()> { self.allow_run.revoke(); - return Ok(()); + Ok(()) } pub fn revoke_read(&self) -> DenoResult<()> { self.allow_read.revoke(); - return Ok(()); + Ok(()) } pub fn revoke_write(&self) -> DenoResult<()> { self.allow_write.revoke(); - return Ok(()); + Ok(()) } pub fn revoke_net(&self) -> DenoResult<()> { self.allow_net.revoke(); - return Ok(()); + Ok(()) } pub fn revoke_env(&self) -> DenoResult<()> { self.allow_env.revoke(); - return Ok(()); + Ok(()) } } diff --git a/cli/resources.rs b/cli/resources.rs index 2f07f0f11c..385b3d5ca7 100644 --- a/cli/resources.rs +++ b/cli/resources.rs @@ -451,8 +451,8 @@ pub fn seek( Some(Repr::FsFile(f)) => { let seek_from = match whence { 0 => SeekFrom::Start(offset as u64), - 1 => SeekFrom::Current(offset as i64), - 2 => SeekFrom::End(offset as i64), + 1 => SeekFrom::Current(i64::from(offset)), + 2 => SeekFrom::End(i64::from(offset)), _ => { return Box::new(futures::future::err(errors::new( errors::ErrorKind::InvalidSeekMode, @@ -481,14 +481,13 @@ pub fn seek( ))); } let mut std_file_copy = maybe_std_file_copy.unwrap(); - return Box::new(futures::future::lazy(move || { + Box::new(futures::future::lazy(move || { let result = std_file_copy .seek(seek_from) - .map(|_| { - return (); - }).map_err(DenoError::from); + .map(|_| {}) + .map_err(DenoError::from); futures::future::result(result) - })); + })) } _ => panic!("cannot seek"), }