summaryrefslogtreecommitdiff
path: root/runtime/ops
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2022-03-14 23:38:53 +0100
committerGitHub <noreply@github.com>2022-03-14 23:38:53 +0100
commit88d0f01948b68f4a4d87e02a5138e94ac0a6eaea (patch)
tree2b50e5d2c6990c94f47e604281f3557b3efd9736 /runtime/ops
parent9f494dc405afc4b1b29fa4c813bd5751f26aaa36 (diff)
feat(ops): custom arity (#13949)
Also cleanup & drop ignored wildcard op-args
Diffstat (limited to 'runtime/ops')
-rw-r--r--runtime/ops/fs.rs97
-rw-r--r--runtime/ops/fs_events.rs2
-rw-r--r--runtime/ops/http.rs1
-rw-r--r--runtime/ops/os.rs53
-rw-r--r--runtime/ops/permissions.rs3
-rw-r--r--runtime/ops/process.rs7
-rw-r--r--runtime/ops/runtime.rs6
-rw-r--r--runtime/ops/signal.rs21
-rw-r--r--runtime/ops/tty.rs13
-rw-r--r--runtime/ops/web_worker.rs11
-rw-r--r--runtime/ops/worker_host.rs4
11 files changed, 29 insertions, 189 deletions
diff --git a/runtime/ops/fs.rs b/runtime/ops/fs.rs
index f7f0ad33c..a3d316ae7 100644
--- a/runtime/ops/fs.rs
+++ b/runtime/ops/fs.rs
@@ -161,7 +161,6 @@ fn open_helper(
fn op_open_sync(
state: &mut OpState,
args: OpenArgs,
- _: (),
) -> Result<ResourceId, AnyError> {
let (path, open_options) = open_helper(state, args)?;
let std_file = open_options.open(&path).map_err(|err| {
@@ -177,7 +176,6 @@ fn op_open_sync(
async fn op_open_async(
state: Rc<RefCell<OpState>>,
args: OpenArgs,
- _: (),
) -> Result<ResourceId, AnyError> {
let (path, open_options) = open_helper(&mut state.borrow_mut(), args)?;
let tokio_file = tokio::fs::OpenOptions::from(open_options)
@@ -217,11 +215,7 @@ fn seek_helper(args: SeekArgs) -> Result<(u32, SeekFrom), AnyError> {
}
#[op]
-fn op_seek_sync(
- state: &mut OpState,
- args: SeekArgs,
- _: (),
-) -> Result<u64, AnyError> {
+fn op_seek_sync(state: &mut OpState, args: SeekArgs) -> Result<u64, AnyError> {
let (rid, seek_from) = seek_helper(args)?;
let pos = StdFileResource::with(state, rid, |r| match r {
Ok(std_file) => std_file.seek(seek_from).map_err(AnyError::from),
@@ -236,7 +230,6 @@ fn op_seek_sync(
async fn op_seek_async(
state: Rc<RefCell<OpState>>,
args: SeekArgs,
- _: (),
) -> Result<u64, AnyError> {
let (rid, seek_from) = seek_helper(args)?;
@@ -261,7 +254,6 @@ async fn op_seek_async(
fn op_fdatasync_sync(
state: &mut OpState,
rid: ResourceId,
- _: (),
) -> Result<(), AnyError> {
StdFileResource::with(state, rid, |r| match r {
Ok(std_file) => std_file.sync_data().map_err(AnyError::from),
@@ -274,7 +266,6 @@ fn op_fdatasync_sync(
async fn op_fdatasync_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- _: (),
) -> Result<(), AnyError> {
let resource = state
.borrow_mut()
@@ -294,11 +285,7 @@ async fn op_fdatasync_async(
}
#[op]
-fn op_fsync_sync(
- state: &mut OpState,
- rid: ResourceId,
- _: (),
-) -> Result<(), AnyError> {
+fn op_fsync_sync(state: &mut OpState, rid: ResourceId) -> Result<(), AnyError> {
StdFileResource::with(state, rid, |r| match r {
Ok(std_file) => std_file.sync_all().map_err(AnyError::from),
Err(_) => Err(type_error("cannot sync this type of resource".to_string())),
@@ -310,7 +297,6 @@ fn op_fsync_sync(
async fn op_fsync_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- _: (),
) -> Result<(), AnyError> {
let resource = state
.borrow_mut()
@@ -333,7 +319,6 @@ async fn op_fsync_async(
fn op_fstat_sync(
state: &mut OpState,
rid: ResourceId,
- _: (),
) -> Result<FsStat, AnyError> {
let metadata = StdFileResource::with(state, rid, |r| match r {
Ok(std_file) => std_file.metadata().map_err(AnyError::from),
@@ -346,7 +331,6 @@ fn op_fstat_sync(
async fn op_fstat_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- _: (),
) -> Result<FsStat, AnyError> {
let resource = state
.borrow_mut()
@@ -432,7 +416,6 @@ async fn op_flock_async(
fn op_funlock_sync(
state: &mut OpState,
rid: ResourceId,
- _: (),
) -> Result<(), AnyError> {
use fs3::FileExt;
super::check_unstable(state, "Deno.funlockSync");
@@ -450,7 +433,6 @@ fn op_funlock_sync(
async fn op_funlock_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- _: (),
) -> Result<(), AnyError> {
use fs3::FileExt;
super::check_unstable2(&state, "Deno.funlock");
@@ -484,11 +466,7 @@ async fn op_funlock_async(
}
#[op]
-fn op_umask(
- state: &mut OpState,
- mask: Option<u32>,
- _: (),
-) -> Result<u32, AnyError> {
+fn op_umask(state: &mut OpState, mask: Option<u32>) -> Result<u32, AnyError> {
super::check_unstable(state, "Deno.umask");
// TODO implement umask for Windows
// see https://github.com/nodejs/node/blob/master/src/node_process_methods.cc
@@ -517,11 +495,7 @@ fn op_umask(
}
#[op]
-fn op_chdir(
- state: &mut OpState,
- directory: String,
- _: (),
-) -> Result<(), AnyError> {
+fn op_chdir(state: &mut OpState, directory: String) -> Result<(), AnyError> {
let d = PathBuf::from(&directory);
state.borrow_mut::<Permissions>().read.check(&d)?;
set_current_dir(&d).map_err(|err| {
@@ -539,11 +513,7 @@ pub struct MkdirArgs {
}
#[op]
-fn op_mkdir_sync(
- state: &mut OpState,
- args: MkdirArgs,
- _: (),
-) -> Result<(), AnyError> {
+fn op_mkdir_sync(state: &mut OpState, args: MkdirArgs) -> Result<(), AnyError> {
let path = Path::new(&args.path).to_path_buf();
let mode = args.mode.unwrap_or(0o777) & 0o777;
state.borrow_mut::<Permissions>().write.check(&path)?;
@@ -565,7 +535,6 @@ fn op_mkdir_sync(
async fn op_mkdir_async(
state: Rc<RefCell<OpState>>,
args: MkdirArgs,
- _: (),
) -> Result<(), AnyError> {
let path = Path::new(&args.path).to_path_buf();
let mode = args.mode.unwrap_or(0o777) & 0o777;
@@ -601,11 +570,7 @@ pub struct ChmodArgs {
}
#[op]
-fn op_chmod_sync(
- state: &mut OpState,
- args: ChmodArgs,
- _: (),
-) -> Result<(), AnyError> {
+fn op_chmod_sync(state: &mut OpState, args: ChmodArgs) -> Result<(), AnyError> {
let path = Path::new(&args.path).to_path_buf();
let mode = args.mode & 0o777;
let err_mapper = |err: Error| {
@@ -634,7 +599,6 @@ fn op_chmod_sync(
async fn op_chmod_async(
state: Rc<RefCell<OpState>>,
args: ChmodArgs,
- _: (),
) -> Result<(), AnyError> {
let path = Path::new(&args.path).to_path_buf();
let mode = args.mode & 0o777;
@@ -677,11 +641,7 @@ pub struct ChownArgs {
}
#[op]
-fn op_chown_sync(
- state: &mut OpState,
- args: ChownArgs,
- _: (),
-) -> Result<(), AnyError> {
+fn op_chown_sync(state: &mut OpState, args: ChownArgs) -> Result<(), AnyError> {
let path = Path::new(&args.path).to_path_buf();
state.borrow_mut::<Permissions>().write.check(&path)?;
debug!(
@@ -715,7 +675,6 @@ fn op_chown_sync(
async fn op_chown_async(
state: Rc<RefCell<OpState>>,
args: ChownArgs,
- _: (),
) -> Result<(), AnyError> {
let path = Path::new(&args.path).to_path_buf();
@@ -764,7 +723,6 @@ pub struct RemoveArgs {
fn op_remove_sync(
state: &mut OpState,
args: RemoveArgs,
- _: (),
) -> Result<(), AnyError> {
let path = PathBuf::from(&args.path);
let recursive = args.recursive;
@@ -810,7 +768,6 @@ fn op_remove_sync(
async fn op_remove_async(
state: Rc<RefCell<OpState>>,
args: RemoveArgs,
- _: (),
) -> Result<(), AnyError> {
let path = PathBuf::from(&args.path);
let recursive = args.recursive;
@@ -869,7 +826,6 @@ pub struct CopyFileArgs {
fn op_copy_file_sync(
state: &mut OpState,
args: CopyFileArgs,
- _: (),
) -> Result<(), AnyError> {
let from = PathBuf::from(&args.from);
let to = PathBuf::from(&args.to);
@@ -908,7 +864,6 @@ fn op_copy_file_sync(
async fn op_copy_file_async(
state: Rc<RefCell<OpState>>,
args: CopyFileArgs,
- _: (),
) -> Result<(), AnyError> {
let from = PathBuf::from(&args.from);
let to = PathBuf::from(&args.to);
@@ -1037,7 +992,6 @@ pub struct StatArgs {
fn op_stat_sync(
state: &mut OpState,
args: StatArgs,
- _: (),
) -> Result<FsStat, AnyError> {
let path = PathBuf::from(&args.path);
let lstat = args.lstat;
@@ -1058,7 +1012,6 @@ fn op_stat_sync(
async fn op_stat_async(
state: Rc<RefCell<OpState>>,
args: StatArgs,
- _: (),
) -> Result<FsStat, AnyError> {
let path = PathBuf::from(&args.path);
let lstat = args.lstat;
@@ -1088,7 +1041,6 @@ async fn op_stat_async(
fn op_realpath_sync(
state: &mut OpState,
path: String,
- _: (),
) -> Result<String, AnyError> {
let path = PathBuf::from(&path);
@@ -1110,7 +1062,6 @@ fn op_realpath_sync(
async fn op_realpath_async(
state: Rc<RefCell<OpState>>,
path: String,
- _: (),
) -> Result<String, AnyError> {
let path = PathBuf::from(&path);
@@ -1148,7 +1099,6 @@ pub struct DirEntry {
fn op_read_dir_sync(
state: &mut OpState,
path: String,
- _: (),
) -> Result<Vec<DirEntry>, AnyError> {
let path = PathBuf::from(&path);
@@ -1189,7 +1139,6 @@ fn op_read_dir_sync(
async fn op_read_dir_async(
state: Rc<RefCell<OpState>>,
path: String,
- _: (),
) -> Result<Vec<DirEntry>, AnyError> {
let path = PathBuf::from(&path);
{
@@ -1242,7 +1191,6 @@ pub struct RenameArgs {
fn op_rename_sync(
state: &mut OpState,
args: RenameArgs,
- _: (),
) -> Result<(), AnyError> {
let oldpath = PathBuf::from(&args.oldpath);
let newpath = PathBuf::from(&args.newpath);
@@ -1271,7 +1219,6 @@ fn op_rename_sync(
async fn op_rename_async(
state: Rc<RefCell<OpState>>,
args: RenameArgs,
- _: (),
) -> Result<(), AnyError> {
let oldpath = PathBuf::from(&args.oldpath);
let newpath = PathBuf::from(&args.newpath);
@@ -1314,11 +1261,7 @@ pub struct LinkArgs {
}
#[op]
-fn op_link_sync(
- state: &mut OpState,
- args: LinkArgs,
- _: (),
-) -> Result<(), AnyError> {
+fn op_link_sync(state: &mut OpState, args: LinkArgs) -> Result<(), AnyError> {
let oldpath = PathBuf::from(&args.oldpath);
let newpath = PathBuf::from(&args.newpath);
@@ -1348,7 +1291,6 @@ fn op_link_sync(
async fn op_link_async(
state: Rc<RefCell<OpState>>,
args: LinkArgs,
- _: (),
) -> Result<(), AnyError> {
let oldpath = PathBuf::from(&args.oldpath);
let newpath = PathBuf::from(&args.newpath);
@@ -1402,7 +1344,6 @@ pub struct SymlinkOptions {
fn op_symlink_sync(
state: &mut OpState,
args: SymlinkArgs,
- _: (),
) -> Result<(), AnyError> {
let oldpath = PathBuf::from(&args.oldpath);
let newpath = PathBuf::from(&args.newpath);
@@ -1464,7 +1405,6 @@ fn op_symlink_sync(
async fn op_symlink_async(
state: Rc<RefCell<OpState>>,
args: SymlinkArgs,
- _: (),
) -> Result<(), AnyError> {
let oldpath = PathBuf::from(&args.oldpath);
let newpath = PathBuf::from(&args.newpath);
@@ -1529,7 +1469,6 @@ async fn op_symlink_async(
fn op_read_link_sync(
state: &mut OpState,
path: String,
- _: (),
) -> Result<String, AnyError> {
let path = PathBuf::from(&path);
@@ -1553,7 +1492,6 @@ fn op_read_link_sync(
async fn op_read_link_async(
state: Rc<RefCell<OpState>>,
path: String,
- _: (),
) -> Result<String, AnyError> {
let path = PathBuf::from(&path);
{
@@ -1589,7 +1527,6 @@ pub struct FtruncateArgs {
fn op_ftruncate_sync(
state: &mut OpState,
args: FtruncateArgs,
- _: (),
) -> Result<(), AnyError> {
let rid = args.rid;
let len = args.len as u64;
@@ -1604,7 +1541,6 @@ fn op_ftruncate_sync(
async fn op_ftruncate_async(
state: Rc<RefCell<OpState>>,
args: FtruncateArgs,
- _: (),
) -> Result<(), AnyError> {
let rid = args.rid;
let len = args.len as u64;
@@ -1637,7 +1573,6 @@ pub struct TruncateArgs {
fn op_truncate_sync(
state: &mut OpState,
args: TruncateArgs,
- _: (),
) -> Result<(), AnyError> {
let path = PathBuf::from(&args.path);
let len = args.len;
@@ -1663,7 +1598,6 @@ fn op_truncate_sync(
async fn op_truncate_async(
state: Rc<RefCell<OpState>>,
args: TruncateArgs,
- _: (),
) -> Result<(), AnyError> {
let path = PathBuf::from(&args.path);
let len = args.len;
@@ -1747,7 +1681,6 @@ pub struct MakeTempArgs {
fn op_make_temp_dir_sync(
state: &mut OpState,
args: MakeTempArgs,
- _: (),
) -> Result<String, AnyError> {
let dir = args.dir.map(|s| PathBuf::from(&s));
let prefix = args.prefix.map(String::from);
@@ -1777,7 +1710,6 @@ fn op_make_temp_dir_sync(
async fn op_make_temp_dir_async(
state: Rc<RefCell<OpState>>,
args: MakeTempArgs,
- _: (),
) -> Result<String, AnyError> {
let dir = args.dir.map(|s| PathBuf::from(&s));
let prefix = args.prefix.map(String::from);
@@ -1812,7 +1744,6 @@ async fn op_make_temp_dir_async(
fn op_make_temp_file_sync(
state: &mut OpState,
args: MakeTempArgs,
- _: (),
) -> Result<String, AnyError> {
let dir = args.dir.map(|s| PathBuf::from(&s));
let prefix = args.prefix.map(String::from);
@@ -1842,7 +1773,6 @@ fn op_make_temp_file_sync(
async fn op_make_temp_file_async(
state: Rc<RefCell<OpState>>,
args: MakeTempArgs,
- _: (),
) -> Result<String, AnyError> {
let dir = args.dir.map(|s| PathBuf::from(&s));
let prefix = args.prefix.map(String::from);
@@ -1885,7 +1815,6 @@ pub struct FutimeArgs {
fn op_futime_sync(
state: &mut OpState,
args: FutimeArgs,
- _: (),
) -> Result<(), AnyError> {
super::check_unstable(state, "Deno.futimeSync");
let rid = args.rid;
@@ -1909,7 +1838,6 @@ fn op_futime_sync(
async fn op_futime_async(
state: Rc<RefCell<OpState>>,
args: FutimeArgs,
- _: (),
) -> Result<(), AnyError> {
super::check_unstable2(&state, "Deno.futime");
let rid = args.rid;
@@ -1955,11 +1883,7 @@ pub struct UtimeArgs {
}
#[op]
-fn op_utime_sync(
- state: &mut OpState,
- args: UtimeArgs,
- _: (),
-) -> Result<(), AnyError> {
+fn op_utime_sync(state: &mut OpState, args: UtimeArgs) -> Result<(), AnyError> {
super::check_unstable(state, "Deno.utime");
let path = PathBuf::from(&args.path);
@@ -1977,7 +1901,6 @@ fn op_utime_sync(
async fn op_utime_async(
state: Rc<RefCell<OpState>>,
args: UtimeArgs,
- _: (),
) -> Result<(), AnyError> {
super::check_unstable(&state.borrow(), "Deno.utime");
@@ -2002,7 +1925,7 @@ async fn op_utime_async(
}
#[op]
-fn op_cwd(state: &mut OpState, _: (), _: ()) -> Result<String, AnyError> {
+fn op_cwd(state: &mut OpState) -> Result<String, AnyError> {
let path = current_dir()?;
state
.borrow_mut::<Permissions>()
diff --git a/runtime/ops/fs_events.rs b/runtime/ops/fs_events.rs
index 8909b2636..02acbd0cc 100644
--- a/runtime/ops/fs_events.rs
+++ b/runtime/ops/fs_events.rs
@@ -98,7 +98,6 @@ pub struct OpenArgs {
fn op_fs_events_open(
state: &mut OpState,
args: OpenArgs,
- _: (),
) -> Result<ResourceId, AnyError> {
let (sender, receiver) = mpsc::channel::<Result<FsEvent, AnyError>>(16);
let sender = Mutex::new(sender);
@@ -133,7 +132,6 @@ fn op_fs_events_open(
async fn op_fs_events_poll(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- _: (),
) -> Result<Option<FsEvent>, AnyError> {
let resource = state.borrow().resource_table.get::<FsEventsResource>(rid)?;
let mut receiver = RcRef::map(&resource, |r| &r.receiver).borrow_mut().await;
diff --git a/runtime/ops/http.rs b/runtime/ops/http.rs
index 25f123b32..47ec31751 100644
--- a/runtime/ops/http.rs
+++ b/runtime/ops/http.rs
@@ -20,7 +20,6 @@ pub fn init() -> Extension {
fn op_http_start(
state: &mut OpState,
tcp_stream_rid: ResourceId,
- _: (),
) -> Result<ResourceId, AnyError> {
if let Ok(resource_rc) = state
.resource_table
diff --git a/runtime/ops/os.rs b/runtime/ops/os.rs
index d9abbb221..ad2ff60ea 100644
--- a/runtime/ops/os.rs
+++ b/runtime/ops/os.rs
@@ -40,7 +40,7 @@ pub fn init(maybe_exit_code: Option<Arc<AtomicI32>>) -> Extension {
}
#[op]
-fn op_exec_path(state: &mut OpState, _: (), _: ()) -> Result<String, AnyError> {
+fn op_exec_path(state: &mut OpState) -> Result<String, AnyError> {
let current_exe = env::current_exe().unwrap();
state
.borrow_mut::<Permissions>()
@@ -71,11 +71,7 @@ fn op_set_env(
}
#[op]
-fn op_env(
- state: &mut OpState,
- _: (),
- _: (),
-) -> Result<HashMap<String, String>, AnyError> {
+fn op_env(state: &mut OpState) -> Result<HashMap<String, String>, AnyError> {
state.borrow_mut::<Permissions>().env.check_all()?;
Ok(env::vars().collect())
}
@@ -84,7 +80,6 @@ fn op_env(
fn op_get_env(
state: &mut OpState,
key: String,
- _: (),
) -> Result<Option<String>, AnyError> {
state.borrow_mut::<Permissions>().env.check(&key)?;
if key.is_empty() || key.contains(&['=', '\0'] as &[char]) {
@@ -98,11 +93,7 @@ fn op_get_env(
}
#[op]
-fn op_delete_env(
- state: &mut OpState,
- key: String,
- _: (),
-) -> Result<(), AnyError> {
+fn op_delete_env(state: &mut OpState, key: String) -> Result<(), AnyError> {
state.borrow_mut::<Permissions>().env.check(&key)?;
if key.is_empty() || key.contains(&['=', '\0'] as &[char]) {
return Err(type_error("Key contains invalid characters."));
@@ -112,27 +103,19 @@ fn op_delete_env(
}
#[op]
-fn op_set_exit_code(
- state: &mut OpState,
- code: i32,
- _: (),
-) -> Result<(), AnyError> {
+fn op_set_exit_code(state: &mut OpState, code: i32) -> Result<(), AnyError> {
state.borrow_mut::<Arc<AtomicI32>>().store(code, Relaxed);
Ok(())
}
#[op]
-fn op_exit(state: &mut OpState, _: (), _: ()) -> Result<(), AnyError> {
+fn op_exit(state: &mut OpState) -> Result<(), AnyError> {
let code = state.borrow::<Arc<AtomicI32>>().load(Relaxed);
std::process::exit(code)
}
#[op]
-fn op_loadavg(
- state: &mut OpState,
- _: (),
- _: (),
-) -> Result<(f64, f64, f64), AnyError> {
+fn op_loadavg(state: &mut OpState) -> Result<(f64, f64, f64), AnyError> {
super::check_unstable(state, "Deno.loadavg");
state.borrow_mut::<Permissions>().env.check_all()?;
match sys_info::loadavg() {
@@ -142,7 +125,7 @@ fn op_loadavg(
}
#[op]
-fn op_hostname(state: &mut OpState, _: (), _: ()) -> Result<String, AnyError> {
+fn op_hostname(state: &mut OpState) -> Result<String, AnyError> {
super::check_unstable(state, "Deno.hostname");
state.borrow_mut::<Permissions>().env.check_all()?;
let hostname = sys_info::hostname().unwrap_or_else(|_| "".to_string());
@@ -150,11 +133,7 @@ fn op_hostname(state: &mut OpState, _: (), _: ()) -> Result<String, AnyError> {
}
#[op]
-fn op_os_release(
- state: &mut OpState,
- _: (),
- _: (),
-) -> Result<String, AnyError> {
+fn op_os_release(state: &mut OpState) -> Result<String, AnyError> {
super::check_unstable(state, "Deno.osRelease");
state.borrow_mut::<Permissions>().env.check_all()?;
let release = sys_info::os_release().unwrap_or_else(|_| "".to_string());
@@ -164,8 +143,6 @@ fn op_os_release(
#[op]
fn op_network_interfaces(
state: &mut OpState,
- _: (),
- _: (),
) -> Result<Vec<NetworkInterface>, AnyError> {
super::check_unstable(state, "Deno.networkInterfaces");
state.borrow_mut::<Permissions>().env.check_all()?;
@@ -232,8 +209,6 @@ struct MemInfo {
#[op]
fn op_system_memory_info(
state: &mut OpState,
- _: (),
- _: (),
) -> Result<Option<MemInfo>, AnyError> {
super::check_unstable(state, "Deno.systemMemoryInfo");
state.borrow_mut::<Permissions>().env.check_all()?;
@@ -253,11 +228,7 @@ fn op_system_memory_info(
#[cfg(not(windows))]
#[op]
-fn op_getuid(
- state: &mut OpState,
- _: (),
- _: (),
-) -> Result<Option<u32>, AnyError> {
+fn op_getuid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
super::check_unstable(state, "Deno.getUid");
state.borrow_mut::<Permissions>().env.check_all()?;
unsafe { Ok(Some(libc::getuid())) }
@@ -265,11 +236,7 @@ fn op_getuid(
#[cfg(windows)]
#[op]
-fn op_getuid(
- state: &mut OpState,
- _: (),
- _: (),
-) -> Result<Option<u32>, AnyError> {
+fn op_getuid(state: &mut OpState) -> Result<Option<u32>, AnyError> {
super::check_unstable(state, "Deno.getUid");
state.borrow_mut::<Permissions>().env.check_all()?;
Ok(None)
diff --git a/runtime/ops/permissions.rs b/runtime/ops/permissions.rs
index 401562439..ed1797701 100644
--- a/runtime/ops/permissions.rs
+++ b/runtime/ops/permissions.rs
@@ -34,7 +34,6 @@ pub struct PermissionArgs {
pub fn op_query_permission(
state: &mut OpState,
args: PermissionArgs,
- _: (),
) -> Result<String, AnyError> {
let permissions = state.borrow::<Permissions>();
let path = args.path.as_deref();
@@ -66,7 +65,6 @@ pub fn op_query_permission(
pub fn op_revoke_permission(
state: &mut OpState,
args: PermissionArgs,
- _: (),
) -> Result<String, AnyError> {
let permissions = state.borrow_mut::<Permissions>();
let path = args.path.as_deref();
@@ -98,7 +96,6 @@ pub fn op_revoke_permission(
pub fn op_request_permission(
state: &mut OpState,
args: PermissionArgs,
- _: (),
) -> Result<String, AnyError> {
let permissions = state.borrow_mut::<Permissions>();
let path = args.path.as_deref();
diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs
index 7c45c47fc..3bc516a80 100644
--- a/runtime/ops/process.rs
+++ b/runtime/ops/process.rs
@@ -99,11 +99,7 @@ struct RunInfo {
}
#[op]
-fn op_run(
- state: &mut OpState,
- run_args: RunArgs,
- _: (),
-) -> Result<RunInfo, AnyError> {
+fn op_run(state: &mut OpState, run_args: RunArgs) -> Result<RunInfo, AnyError> {
let args = run_args.cmd;
state.borrow_mut::<Permissions>().run.check(&args[0])?;
let env = run_args.env;
@@ -227,7 +223,6 @@ struct ProcessStatus {
async fn op_run_status(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- _: (),
) -> Result<ProcessStatus, AnyError> {
let resource = state
.borrow_mut()
diff --git a/runtime/ops/runtime.rs b/runtime/ops/runtime.rs
index 4f951383e..31f9d2732 100644
--- a/runtime/ops/runtime.rs
+++ b/runtime/ops/runtime.rs
@@ -19,11 +19,7 @@ pub fn init(main_module: ModuleSpecifier) -> Extension {
}
#[op]
-fn op_main_module(
- state: &mut OpState,
- _: (),
- _: (),
-) -> Result<String, AnyError> {
+fn op_main_module(state: &mut OpState) -> Result<String, AnyError> {
let main = state.borrow::<ModuleSpecifier>().to_string();
let main_url = deno_core::resolve_url_or_path(&main)?;
if main_url.scheme() == "file" {
diff --git a/runtime/ops/signal.rs b/runtime/ops/signal.rs
index d9f05a777..efab5a932 100644
--- a/runtime/ops/signal.rs
+++ b/runtime/ops/signal.rs
@@ -178,7 +178,6 @@ pub fn signal_str_to_int(s: &str) -> Result<libc::c_int, AnyError> {
fn op_signal_bind(
state: &mut OpState,
sig: String,
- _: (),
) -> Result<ResourceId, AnyError> {
let signo = signal_str_to_int(&sig)?;
if signal_hook_registry::FORBIDDEN.contains(&signo) {
@@ -200,7 +199,6 @@ fn op_signal_bind(
async fn op_signal_poll(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- _: (),
) -> Result<bool, AnyError> {
let resource = state
.borrow_mut()
@@ -220,7 +218,6 @@ async fn op_signal_poll(
pub fn op_signal_unbind(
state: &mut OpState,
rid: ResourceId,
- _: (),
) -> Result<(), AnyError> {
state.resource_table.close(rid)?;
Ok(())
@@ -228,30 +225,18 @@ pub fn op_signal_unbind(
#[cfg(not(unix))]
#[op]
-pub fn op_signal_bind(
- _state: &mut OpState,
- _: (),
- _: (),
-) -> Result<(), AnyError> {
+pub fn op_signal_bind(_state: &mut OpState) -> Result<(), AnyError> {
Err(generic_error("not implemented"))
}
#[cfg(not(unix))]
#[op]
-fn op_signal_unbind(
- _state: &mut OpState,
- _: (),
- _: (),
-) -> Result<(), AnyError> {
+fn op_signal_unbind(_state: &mut OpState) -> Result<(), AnyError> {
Err(generic_error("not implemented"))
}
#[cfg(not(unix))]
#[op]
-async fn op_signal_poll(
- _state: Rc<RefCell<OpState>>,
- _: (),
- _: (),
-) -> Result<(), AnyError> {
+async fn op_signal_poll(_state: Rc<RefCell<OpState>>) -> Result<(), AnyError> {
Err(generic_error("not implemented"))
}
diff --git a/runtime/ops/tty.rs b/runtime/ops/tty.rs
index bbf6bd412..465fb1679 100644
--- a/runtime/ops/tty.rs
+++ b/runtime/ops/tty.rs
@@ -68,11 +68,7 @@ pub struct SetRawArgs {
}
#[op]
-fn op_set_raw(
- state: &mut OpState,
- args: SetRawArgs,
- _: (),
-) -> Result<(), AnyError> {
+fn op_set_raw(state: &mut OpState, args: SetRawArgs) -> Result<(), AnyError> {
super::check_unstable(state, "Deno.setRaw");
let rid = args.rid;
@@ -213,11 +209,7 @@ fn op_set_raw(
}
#[op]
-fn op_isatty(
- state: &mut OpState,
- rid: ResourceId,
- _: (),
-) -> Result<bool, AnyError> {
+fn op_isatty(state: &mut OpState, rid: ResourceId) -> Result<bool, AnyError> {
let isatty: bool = StdFileResource::with(state, rid, move |r| match r {
Ok(std_file) => {
#[cfg(windows)]
@@ -251,7 +243,6 @@ struct ConsoleSize {
fn op_console_size(
state: &mut OpState,
rid: ResourceId,
- _: (),
) -> Result<ConsoleSize, AnyError> {
super::check_unstable(state, "Deno.consoleSize");
diff --git a/runtime/ops/web_worker.rs b/runtime/ops/web_worker.rs
index 3c64cf1f6..4137217bd 100644
--- a/runtime/ops/web_worker.rs
+++ b/runtime/ops/web_worker.rs
@@ -33,7 +33,6 @@ pub fn init() -> Extension {
fn op_worker_post_message(
state: &mut OpState,
data: JsMessageData,
- _: (),
) -> Result<(), AnyError> {
let handle = state.borrow::<WebWorkerInternalHandle>().clone();
handle.port.send(state, data)?;
@@ -43,8 +42,6 @@ fn op_worker_post_message(
#[op]
async fn op_worker_recv_message(
state: Rc<RefCell<OpState>>,
- _: (),
- _: (),
) -> Result<Option<JsMessageData>, AnyError> {
let handle = {
let state = state.borrow();
@@ -58,7 +55,7 @@ async fn op_worker_recv_message(
}
#[op]
-fn op_worker_close(state: &mut OpState, _: (), _: ()) -> Result<(), AnyError> {
+fn op_worker_close(state: &mut OpState) -> Result<(), AnyError> {
// Notify parent that we're finished
let mut handle = state.borrow_mut::<WebWorkerInternalHandle>().clone();
@@ -67,11 +64,7 @@ fn op_worker_close(state: &mut OpState, _: (), _: ()) -> Result<(), AnyError> {
}
#[op]
-fn op_worker_get_type(
- state: &mut OpState,
- _: (),
- _: (),
-) -> Result<WebWorkerType, AnyError> {
+fn op_worker_get_type(state: &mut OpState) -> Result<WebWorkerType, AnyError> {
let handle = state.borrow::<WebWorkerInternalHandle>().clone();
Ok(handle.worker_type)
}
diff --git a/runtime/ops/worker_host.rs b/runtime/ops/worker_host.rs
index cebce81a4..6c691c5a0 100644
--- a/runtime/ops/worker_host.rs
+++ b/runtime/ops/worker_host.rs
@@ -148,7 +148,6 @@ pub struct CreateWorkerArgs {
fn op_create_worker(
state: &mut OpState,
args: CreateWorkerArgs,
- _: (),
) -> Result<WorkerId, AnyError> {
let specifier = args.specifier.clone();
let maybe_source_code = if args.has_source_code {
@@ -265,7 +264,6 @@ fn op_create_worker(
fn op_host_terminate_worker(
state: &mut OpState,
id: WorkerId,
- _: (),
) -> Result<(), AnyError> {
if let Some(worker_thread) = state.borrow_mut::<WorkersTable>().remove(&id) {
worker_thread.terminate();
@@ -320,7 +318,6 @@ fn close_channel(
async fn op_host_recv_ctrl(
state: Rc<RefCell<OpState>>,
id: WorkerId,
- _: (),
) -> Result<WorkerControlEvent, AnyError> {
let worker_handle = {
let state = state.borrow();
@@ -352,7 +349,6 @@ async fn op_host_recv_ctrl(
async fn op_host_recv_message(
state: Rc<RefCell<OpState>>,
id: WorkerId,
- _: (),
) -> Result<Option<JsMessageData>, AnyError> {
let worker_handle = {
let s = state.borrow();