From e5962fda4bf552d3488f976945933cff8b77a645 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Wed, 15 Feb 2017 20:32:36 +0900 Subject: [PATCH] Ban DOMRefCell> by lint plugin --- components/plugins/lints/ban.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/plugins/lints/ban.rs b/components/plugins/lints/ban.rs index bd152dfe313..4a4e71c08cc 100644 --- a/components/plugins/lints/ban.rs +++ b/components/plugins/lints/ban.rs @@ -43,5 +43,11 @@ impl EarlyLintPass for BanPass { .is_some() { cx.span_lint(BANNED_TYPE, ty.span, "Banned type DOMRefCell> detected. Use MutJS> instead") } + if match_ty_unwrap(ty, &["dom", "bindings", "cell", "DOMRefCell"]) + .and_then(|t| t.get(0)) + .and_then(|t| match_ty_unwrap(&**t, &["js", "jsapi", "Heap"])) + .is_some() { + cx.span_lint(BANNED_TYPE, ty.span, "Banned type DOMRefCell> detected. Use Heap directly instead") + } } }