Skip to content

Commit fa29695

Browse files
committed
Instrumentation: Stricter linting & bump oxc
1 parent 75a534b commit fa29695

File tree

5 files changed

+65
-66
lines changed

5 files changed

+65
-66
lines changed

.github/workflows/lint-code.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
- name: Check formatting
3939
run: npm run format:check
4040
- name: Check Rust formatting
41-
run: cd instrumentation-wasm && cargo fmt --check
41+
run: cargo fmt --check
42+
working-directory: ./instrumentation-wasm
4243
- name: Run Rust Linter
43-
run: cd instrumentation-wasm && cargo clippy
44+
run: cargo clippy -- -D warnings
45+
working-directory: ./instrumentation-wasm

instrumentation-wasm/Cargo.lock

Lines changed: 50 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

instrumentation-wasm/Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ name = "node_code_instrumentation"
1010
crate-type = ["cdylib", "rlib"]
1111

1212
[dependencies]
13-
oxc_allocator = "0.96.0"
14-
oxc_ast = "0.96.0"
15-
oxc_codegen = "0.96.0"
16-
oxc_parser = "0.96.0"
17-
oxc_semantic = "0.96.0"
18-
oxc_span = "0.96.0"
19-
oxc_traverse = "0.96.0"
13+
oxc_allocator = "0.102.0"
14+
oxc_ast = "0.102.0"
15+
oxc_codegen = "0.102.0"
16+
oxc_parser = "0.102.0"
17+
oxc_semantic = "0.102.0"
18+
oxc_span = "0.102.0"
19+
oxc_traverse = "0.102.0"
2020
serde = "1.0.228"
2121
serde_json = "1.0.145"
2222
wasm-bindgen = "0.2.105"

instrumentation-wasm/src/js_transformer/helpers/transform_return_statements.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ fn transform_statement<'a>(
5252
.take()
5353
.unwrap_or_else(|| builder.expression_identifier(SPAN, "undefined"));
5454

55-
let needs_await = match arg_expr {
56-
Expression::AwaitExpression(_) => true,
57-
_ => false,
58-
};
55+
let needs_await = matches!(arg_expr, Expression::AwaitExpression(_));
5956

6057
instrument_args.push(arg_expr.into());
6158

instrumentation-wasm/src/js_transformer/transformer_impl.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl<'a> Traverse<'a, TraverseState> for Transformer<'a> {
111111

112112
// We need to collect the arg names before we make the body mutable
113113
let arg_names = if instruction.modify_args {
114-
get_function_or_method_arg_names(&function_args)
114+
get_function_or_method_arg_names(function_args)
115115
} else {
116116
Vec::new()
117117
};
@@ -194,7 +194,7 @@ impl<'a> Traverse<'a, TraverseState> for Transformer<'a> {
194194
node: &mut oxc_ast::ast::VariableDeclarator<'a>,
195195
_ctx: &mut TraverseCtx<'a, TraverseState>,
196196
) {
197-
if !node.id.kind.is_binding_identifier() || !node.init.is_some() {
197+
if !node.id.kind.is_binding_identifier() || node.init.is_none() {
198198
return;
199199
}
200200

@@ -226,7 +226,7 @@ impl<'a> Traverse<'a, TraverseState> for Transformer<'a> {
226226

227227
// We need to collect the arg names before we make the body mutable
228228
let arg_names = if instruction.modify_args {
229-
get_function_or_method_arg_names(&function_args)
229+
get_function_or_method_arg_names(function_args)
230230
} else {
231231
Vec::new()
232232
};

0 commit comments

Comments
 (0)