Skip to content

Commit c3dfce7

Browse files
chore: remove unused ctx params (#556)
* Remove unused ctx params * Fix errors * elided lifetimes * Clippy
1 parent 8097322 commit c3dfce7

File tree

12 files changed

+17
-37
lines changed

12 files changed

+17
-37
lines changed

llrt_core/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ async fn main() -> StdResult<(), Box<dyn Error>> {
130130
info!("Done!");
131131

132132
ph_map.entry(
133-
module_name.replace("\\", "/"),
134-
&format!("include_bytes!(\"{}\")", &lrt_filename).replace("\\", "/"),
133+
module_name.replace('\\', "/"),
134+
&format!("include_bytes!(\"{}\")", &lrt_filename).replace('\\', "/"),
135135
);
136136
}
137137

llrt_core/src/modules/llrt/xml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'js> StackObject<'js> {
7878
#[rquickjs::methods(rename_all = "camelCase")]
7979
impl<'js> XMLParser<'js> {
8080
#[qjs(constructor)]
81-
pub fn new(_ctx: Ctx<'js>, options: Opt<Object<'js>>) -> Result<Self> {
81+
pub fn new(options: Opt<Object<'js>>) -> Result<Self> {
8282
let mut tag_value_processor = None;
8383
let mut attribute_value_processor = None;
8484
let mut attribute_name_prefix = String::from("@_");

llrt_core/src/vm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ fn init(ctx: &Ctx<'_>, module_names: HashSet<&'static str>) -> Result<()> {
563563
js_bootstrap.set(
564564
"moduleExport",
565565
Func::from(move |ctx, obj, prop, value| {
566-
let ExportArgs(_ctx, _, _, value) = ExportArgs(ctx, obj, prop, value);
566+
let ExportArgs(_, _, _, value) = ExportArgs(ctx, obj, prop, value);
567567
let mut exports = require_exports.lock().unwrap();
568568
exports.replace(value);
569569
Result::Ok(true)

llrt_modules/src/modules/child_process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl<'js> ChildProcess<'js> {
155155
self.pid.into_js(&ctx)
156156
}
157157

158-
fn kill(&mut self, _ctx: Ctx<'js>, signal: Opt<Value<'js>>) -> Result<bool> {
158+
fn kill(&mut self, signal: Opt<Value<'js>>) -> Result<bool> {
159159
#[cfg(unix)]
160160
let signal = if let Some(signal) = signal.0 {
161161
if signal.is_number() {

llrt_modules/src/modules/crypto/crc32.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl Crc32c {
2323
}
2424

2525
#[qjs(rename = "digest")]
26-
fn crc32c_digest(&self, _ctx: Ctx<'_>) -> u64 {
26+
fn crc32c_digest(&self) -> u64 {
2727
self.hasher.finish()
2828
}
2929

@@ -56,7 +56,7 @@ impl Crc32 {
5656
}
5757

5858
#[qjs(rename = "digest")]
59-
fn crc32_digest(&self, _ctx: Ctx<'_>) -> u64 {
59+
fn crc32_digest(&self) -> u64 {
6060
self.hasher.finish()
6161
}
6262

llrt_modules/src/modules/crypto/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn get_random_bytes(ctx: Ctx, length: usize) -> Result<Value> {
6565
Buffer(random_bytes).into_js(&ctx)
6666
}
6767

68-
fn get_random_int(_ctx: Ctx, first: i64, second: Opt<i64>) -> Result<i64> {
68+
fn get_random_int(first: i64, second: Opt<i64>) -> Result<i64> {
6969
let mut rng = ThreadRng::default();
7070
let random_number = match second.0 {
7171
Some(max) => rng.gen_range(first..max),

llrt_modules/src/modules/events/custom_event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub struct CustomEvent<'js> {
1414
#[rquickjs::methods]
1515
impl<'js> CustomEvent<'js> {
1616
#[qjs(constructor)]
17-
pub fn new(_ctx: Ctx<'js>, event_type: String, options: Opt<Value<'js>>) -> Result<Self> {
17+
pub fn new(event_type: String, options: Opt<Value<'js>>) -> Result<Self> {
1818
let mut detail = None;
1919
if let Some(options) = options.0 {
2020
if let Some(opt) = options.get_optional("detail")? {

llrt_modules/src/modules/fs/read_dir.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,7 @@ impl<'js> IntoJs<'js> for ReadDir {
106106
}
107107
}
108108

109-
pub async fn read_dir<'js>(
110-
_ctx: Ctx<'js>,
111-
mut path: String,
112-
options: Opt<Object<'js>>,
113-
) -> Result<ReadDir> {
109+
pub async fn read_dir(mut path: String, options: Opt<Object<'_>>) -> Result<ReadDir> {
114110
let (with_file_types, skip_root_pos, mut directory_walker) =
115111
process_options_and_create_directory_walker(&mut path, options);
116112

@@ -131,11 +127,7 @@ pub async fn read_dir<'js>(
131127
Ok(ReadDir { items, root: path })
132128
}
133129

134-
pub fn read_dir_sync<'js>(
135-
_ctx: Ctx<'js>,
136-
mut path: String,
137-
options: Opt<Object<'js>>,
138-
) -> Result<ReadDir> {
130+
pub fn read_dir_sync(mut path: String, options: Opt<Object<'_>>) -> Result<ReadDir> {
139131
let (with_file_types, skip_root_pos, mut directory_walker) =
140132
process_options_and_create_directory_walker(&mut path, options);
141133

llrt_modules/src/modules/fs/rm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub async fn rmfile<'js>(ctx: Ctx<'js>, path: String, options: Opt<Object<'js>>)
6161
Ok(())
6262
}
6363

64-
pub fn rmfile_sync<'js>(_ctx: Ctx<'js>, path: String, options: Opt<Object<'js>>) -> Result<()> {
64+
pub fn rmfile_sync(path: String, options: Opt<Object<'_>>) -> Result<()> {
6565
let (recursive, force) = get_params_rm(options);
6666

6767
let res = (|| -> Result<()> {

llrt_modules/src/modules/net/socket.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,10 @@ impl<'js> Socket<'js> {
139139
Ok(())
140140
}
141141

142-
pub fn destroy(
143-
this: This<Class<'js, Self>>,
144-
ctx: Ctx<'js>,
145-
error: Opt<Value<'js>>,
146-
) -> Class<'js, Self> {
142+
pub fn destroy(this: This<Class<'js, Self>>, error: Opt<Value<'js>>) -> Class<'js, Self> {
147143
this.borrow_mut().destroyed = true;
148-
ReadableStream::destroy(This(this.clone()), ctx.clone(), Opt(None));
149-
WritableStream::destroy(This(this.clone()), ctx.clone(), error);
144+
ReadableStream::destroy(This(this.clone()), Opt(None));
145+
WritableStream::destroy(This(this.clone()), error);
150146
this.0
151147
}
152148

0 commit comments

Comments
 (0)