Skip to content

Commit 52ee169

Browse files
committed
chore: fix clippy needless_borrow and allow too_many_arguments on emit
1 parent 32bb9b3 commit 52ee169

7 files changed

Lines changed: 31 additions & 90 deletions

File tree

Cargo.lock

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

crates/vastlint-core/src/rules/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub fn run(
5050
/// Pass `node` to attach the element's source position to the issue. Pass
5151
/// `None` for document-level issues (e.g. missing root element, parse errors).
5252
#[inline]
53+
#[allow(clippy::too_many_arguments)]
5354
pub(crate) fn emit(
5455
ctx: &ValidationContext,
5556
issues: &mut Vec<Issue>,

crates/vastlint-core/src/rules/required.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn check_ad(
149149
"<Ad> must contain either <InLine> or <Wrapper>",
150150
Some(path.clone()),
151151
"IAB VAST 2.0 §2.2",
152-
Some(&ad),
152+
Some(ad),
153153
);
154154
return;
155155
}
@@ -163,7 +163,7 @@ fn check_ad(
163163
"<Ad> must not contain both <InLine> and <Wrapper>",
164164
Some(path.clone()),
165165
"IAB VAST 2.0 §2.2",
166-
Some(&ad),
166+
Some(ad),
167167
)
168168
}
169169

@@ -200,7 +200,7 @@ fn check_inline(
200200
"<InLine> is missing required <AdSystem>",
201201
Some(path.clone()),
202202
"IAB VAST 2.0 §2.3.1",
203-
Some(&inline),
203+
Some(inline),
204204
)
205205
}
206206

@@ -215,7 +215,7 @@ fn check_inline(
215215
"<InLine> is missing required <AdTitle>",
216216
Some(path.clone()),
217217
"IAB VAST 2.0 §2.3.2",
218-
Some(&inline),
218+
Some(inline),
219219
)
220220
}
221221

@@ -230,7 +230,7 @@ fn check_inline(
230230
"<InLine> is missing required <Impression>",
231231
Some(path.clone()),
232232
"IAB VAST 2.0 §2.3.4",
233-
Some(&inline),
233+
Some(inline),
234234
)
235235
}
236236

@@ -246,7 +246,7 @@ fn check_inline(
246246
"<InLine> is missing required <Creatives>",
247247
Some(path.clone()),
248248
"IAB VAST 2.0 §2.3.5",
249-
Some(&inline),
249+
Some(inline),
250250
),
251251
Some(creatives) => {
252252
if creatives.children_named("Creative").count() == 0 {
@@ -258,7 +258,7 @@ fn check_inline(
258258
"<Creatives> must contain at least one <Creative>",
259259
Some(format!("{}/Creatives", path)),
260260
"IAB VAST 2.0 §2.3.5",
261-
Some(&inline),
261+
Some(inline),
262262
)
263263
}
264264
}
@@ -277,7 +277,7 @@ fn check_inline(
277277
"<InLine> is missing required <AdServingId> (required since VAST 4.1)",
278278
Some(path.clone()),
279279
"IAB VAST 4.1 §3.4.1",
280-
Some(&inline),
280+
Some(inline),
281281
)
282282
}
283283
}
@@ -337,7 +337,7 @@ fn check_inline_creative(
337337
"<Creative> is missing required <UniversalAdId> (required since VAST 4.0)",
338338
Some(creative_path.to_owned()),
339339
"IAB VAST 4.0 §3.8.1",
340-
Some(&creative),
340+
Some(creative),
341341
)
342342
}
343343
}
@@ -354,7 +354,7 @@ fn check_inline_creative(
354354
"<UniversalAdId> is missing required idRegistry attribute",
355355
Some(format!("{}/UniversalAdId", creative_path)),
356356
"IAB VAST 4.0 §3.8.1",
357-
Some(&creative),
357+
Some(creative),
358358
)
359359
}
360360
// VAST-4.0-universaladid-idvalue / VAST-4.1-universaladid-idvalue-removed
@@ -420,7 +420,7 @@ fn check_inline_linear(
420420
"<Linear> is missing required <Duration>",
421421
Some(linear_path.to_owned()),
422422
"IAB VAST 2.0 §2.3.5.1",
423-
Some(&linear),
423+
Some(linear),
424424
)
425425
}
426426

@@ -436,7 +436,7 @@ fn check_inline_linear(
436436
"<Linear> is missing required <MediaFiles>",
437437
Some(linear_path.to_owned()),
438438
"IAB VAST 2.0 §2.3.5.2",
439-
Some(&linear),
439+
Some(linear),
440440
),
441441
Some(mf) => {
442442
if mf.children_named("MediaFile").count() == 0 {
@@ -448,7 +448,7 @@ fn check_inline_linear(
448448
"<MediaFiles> must contain at least one <MediaFile>",
449449
Some(format!("{}/MediaFiles", linear_path)),
450450
"IAB VAST 2.0 §2.3.5.2",
451-
Some(&linear),
451+
Some(linear),
452452
)
453453
}
454454
// Check each MediaFile has required attrs.
@@ -501,7 +501,7 @@ fn check_inline_linear(
501501
"<InteractiveCreativeFile> should have an apiFramework attribute (e.g. \"SIMID\")",
502502
Some(icf_path.clone()),
503503
"IAB VAST 4.0 §2.3.5.4",
504-
Some(&linear),
504+
Some(linear),
505505
)
506506
}
507507

@@ -517,7 +517,7 @@ fn check_inline_linear(
517517
"<InteractiveCreativeFile> should have a type attribute identifying the MIME type",
518518
Some(icf_path.clone()),
519519
"IAB VAST 4.1 §3.9.3",
520-
Some(&linear),
520+
Some(linear),
521521
)
522522
}
523523
}
@@ -538,7 +538,7 @@ fn check_mediafile(mf: &Node, path: &str, ctx: &ValidationContext, issues: &mut
538538
"<MediaFile> is missing required delivery attribute",
539539
Some(path.to_owned()),
540540
"IAB VAST 2.0 §2.3.5.2",
541-
Some(&mf),
541+
Some(mf),
542542
)
543543
}
544544

@@ -553,7 +553,7 @@ fn check_mediafile(mf: &Node, path: &str, ctx: &ValidationContext, issues: &mut
553553
"<MediaFile> is missing required type attribute",
554554
Some(path.to_owned()),
555555
"IAB VAST 2.0 §2.3.5.2",
556-
Some(&mf),
556+
Some(mf),
557557
)
558558
}
559559

@@ -568,7 +568,7 @@ fn check_mediafile(mf: &Node, path: &str, ctx: &ValidationContext, issues: &mut
568568
"<MediaFile> is missing required width attribute",
569569
Some(path.to_owned()),
570570
"IAB VAST 2.0 §2.3.5.2",
571-
Some(&mf),
571+
Some(mf),
572572
)
573573
}
574574
if mf.attr("height").is_none() {
@@ -580,7 +580,7 @@ fn check_mediafile(mf: &Node, path: &str, ctx: &ValidationContext, issues: &mut
580580
"<MediaFile> is missing required height attribute",
581581
Some(path.to_owned()),
582582
"IAB VAST 2.0 §2.3.5.2",
583-
Some(&mf),
583+
Some(mf),
584584
)
585585
}
586586
}
@@ -606,7 +606,7 @@ fn check_wrapper(
606606
"<Wrapper> is missing required <AdSystem>",
607607
Some(path.clone()),
608608
"IAB VAST 2.0 §2.3.1",
609-
Some(&wrapper),
609+
Some(wrapper),
610610
)
611611
}
612612

@@ -620,7 +620,7 @@ fn check_wrapper(
620620
"<Wrapper> is missing required <Impression>",
621621
Some(path.clone()),
622622
"IAB VAST 2.0 §2.3.4",
623-
Some(&wrapper),
623+
Some(wrapper),
624624
)
625625
}
626626

@@ -635,7 +635,7 @@ fn check_wrapper(
635635
"<Wrapper> is missing required <VASTAdTagURI>",
636636
Some(path.clone()),
637637
"IAB VAST 2.0 §2.4",
638-
Some(&wrapper),
638+
Some(wrapper),
639639
)
640640
}
641641

@@ -1101,7 +1101,7 @@ fn check_companion_resource(
11011101
"<Companion> must contain at least one StaticResource, IFrameResource, or HTMLResource",
11021102
Some(path.to_owned()),
11031103
"IAB VAST 2.0 §2.3.7",
1104-
Some(&companion),
1104+
Some(companion),
11051105
)
11061106
}
11071107
}
@@ -1126,7 +1126,7 @@ fn check_nonlinear_resource(
11261126
"<NonLinear> must contain at least one StaticResource, IFrameResource, or HTMLResource",
11271127
Some(path.to_owned()),
11281128
"IAB VAST 2.0 §2.3.6.1",
1129-
Some(&nl),
1129+
Some(nl),
11301130
)
11311131
}
11321132
}

crates/vastlint-core/src/rules/values.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ fn check_mediafile_values(mf: &Node, path: &str, ctx: &ValidationContext, issues
262262
"<MediaFile> delivery attribute must be \"progressive\" or \"streaming\"",
263263
Some(format!("{}[@delivery]", path)),
264264
"IAB VAST 2.0 §2.3.5.2",
265-
Some(&mf),
265+
Some(mf),
266266
)
267267
}
268268
}
@@ -279,7 +279,7 @@ fn check_mediafile_values(mf: &Node, path: &str, ctx: &ValidationContext, issues
279279
"<MediaFile> must have both minBitrate and maxBitrate, or neither",
280280
Some(path.to_owned()),
281281
"IAB VAST 3.0 §2.3.5.2",
282-
Some(&mf),
282+
Some(mf),
283283
)
284284
}
285285

@@ -293,7 +293,7 @@ fn check_mediafile_values(mf: &Node, path: &str, ctx: &ValidationContext, issues
293293
"<MediaFile> should not specify both bitrate and minBitrate/maxBitrate",
294294
Some(path.to_owned()),
295295
"IAB VAST 3.0 §2.3.5.2",
296-
Some(&mf),
296+
Some(mf),
297297
)
298298
}
299299
}

crates/vastlint-wasm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ fn to_js(result: vastlint_core::ValidationResult) -> Result<JsValue, JsValue> {
198198

199199
// Patch: manually set line/col on each issue object because
200200
// serde-wasm-bindgen 0.6 drops Option<numeric> fields.
201-
let issues_arr = js_sys::Reflect::get(&val, &JsValue::from_str("issues")).map_err(|e| e)?;
201+
let issues_arr = js_sys::Reflect::get(&val, &JsValue::from_str("issues"))?;
202202
let issues_arr = js_sys::Array::from(&issues_arr);
203203
for (idx, (line, col)) in line_cols.iter().enumerate() {
204204
let issue_obj = issues_arr.get(idx as u32);

npm/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"types": "./index.d.ts",
2424
"exports": {
2525
".": {
26+
"workerd": "./index.cjs",
2627
"import": "./index.js",
2728
"require": "./index.cjs",
2829
"types": "./index.d.ts"

npm/vastlint_wasm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import * as wasm from "./vastlint_wasm_bg.wasm";
44
import { __wbg_set_wasm } from "./vastlint_wasm_bg.js";
55
__wbg_set_wasm(wasm);
6-
wasm.__wbindgen_start();
6+
if (typeof wasm.__wbindgen_start === "function") wasm.__wbindgen_start();
77
export {
88
rules, validate, validateWithOptions
99
} from "./vastlint_wasm_bg.js";

0 commit comments

Comments
 (0)