diff options
author | bors-servo <servo-ops@mozilla.com> | 2022-08-06 07:20:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-06 07:20:18 -0400 |
commit | 9c6847a387cb515bd73336cf1439c942a33a0758 (patch) | |
tree | 3c2dced21f2bd7e0c36354918499ac3fab2919ed /components/script_plugins/lib.rs | |
parent | 9c41c14649a8b42f81e6bd9ce76a546d9767c8e9 (diff) | |
parent | 3e5cd8815da2ef649658e45f949e29308d1bb853 (diff) | |
download | servo-9c6847a387cb515bd73336cf1439c942a33a0758.tar.gz servo-9c6847a387cb515bd73336cf1439c942a33a0758.zip |
Auto merge of #28910 - teymour-aldridge:clippy, r=jdm
Fix some Clippy lints.
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
<!-- Either: -->
- [ ] These changes do not require tests because they do not change the behaviour of the code
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script_plugins/lib.rs')
-rw-r--r-- | components/script_plugins/lib.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/components/script_plugins/lib.rs b/components/script_plugins/lib.rs index 7de352281d7..498e6027cac 100644 --- a/components/script_plugins/lib.rs +++ b/components/script_plugins/lib.rs @@ -286,21 +286,21 @@ impl<'tcx> LateLintPass<'tcx> for UnrootedPass { } } - if !in_new_function { - if is_unrooted_ty(&self.symbols, cx, sig.output().skip_binder(), false) { - cx.lint(UNROOTED_MUST_ROOT, |lint| { - lint.build("Type must be rooted") - .set_span(decl.output.span()) - .emit() - }) - } + if !in_new_function && + is_unrooted_ty(&self.symbols, cx, sig.output().skip_binder(), false) + { + cx.lint(UNROOTED_MUST_ROOT, |lint| { + lint.build("Type must be rooted") + .set_span(decl.output.span()) + .emit() + }) } } let mut visitor = FnDefVisitor { symbols: &self.symbols, - cx: cx, - in_new_function: in_new_function, + cx, + in_new_function, }; visit::walk_expr(&mut visitor, &body.value); } @@ -331,7 +331,7 @@ impl<'a, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'tcx> { match expr.kind { // Trait casts from #[unrooted_must_root_lint::must_root] types are not allowed - ExprKind::Cast(ref subexpr, _) => require_rooted(cx, self.in_new_function, &*subexpr), + ExprKind::Cast(subexpr, _) => require_rooted(cx, self.in_new_function, &subexpr), // This catches assignments... the main point of this would be to catch mutable // references to `JS<T>`. // FIXME: Enable this? Triggers on certain kinds of uses of DomRefCell. @@ -362,7 +362,7 @@ impl<'a, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'tcx> { hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, ..) | hir::PatKind::Binding(hir::BindingAnnotation::Mutable, ..) => { let ty = cx.typeck_results().pat_ty(pat); - if is_unrooted_ty(&self.symbols, cx, ty, self.in_new_function) { + if is_unrooted_ty(self.symbols, cx, ty, self.in_new_function) { cx.lint(UNROOTED_MUST_ROOT, |lint| { lint.build(&format!("Expression of type {:?} must be rooted", ty)) .set_span(pat.span) |