aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_plugins/utils.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2019-09-29 23:20:48 +0200
committerSimon Sapin <simon.sapin@exyr.org>2019-09-29 23:20:48 +0200
commit81b7f046bfbc9b51a4a2b81e4640f39c03255223 (patch)
treea758b53ae1510c874d7809f9344c8b7a9f429eea /components/script_plugins/utils.rs
parent47c269360cebba4857433bc2ef4dead70b42a01a (diff)
downloadservo-81b7f046bfbc9b51a4a2b81e4640f39c03255223.tar.gz
servo-81b7f046bfbc9b51a4a2b81e4640f39c03255223.zip
Move script_plugins to a single file
Diffstat (limited to 'components/script_plugins/utils.rs')
-rw-r--r--components/script_plugins/utils.rs38
1 files changed, 0 insertions, 38 deletions
diff --git a/components/script_plugins/utils.rs b/components/script_plugins/utils.rs
deleted file mode 100644
index 6815b7bb0a6..00000000000
--- a/components/script_plugins/utils.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-
-use rustc::hir::def_id::DefId;
-use rustc::lint::LateContext;
-use syntax::source_map::{ExpnKind, MacroKind, Span};
-use syntax::symbol::Symbol;
-
-/// check if a DefId's path matches the given absolute type path
-/// usage e.g. with
-/// `match_def_path(cx, id, &["core", "option", "Option"])`
-pub fn match_def_path(cx: &LateContext, def_id: DefId, path: &[Symbol]) -> bool {
- let krate = &cx.tcx.crate_name(def_id.krate);
- if krate != &path[0] {
- return false;
- }
-
- let path = &path[1..];
- let other = cx.tcx.def_path(def_id).data;
-
- if other.len() != path.len() {
- return false;
- }
-
- other
- .into_iter()
- .zip(path)
- .all(|(e, p)| e.data.as_interned_str().as_symbol() == *p)
-}
-
-pub fn in_derive_expn(span: Span) -> bool {
- if let ExpnKind::Macro(MacroKind::Attr, n) = span.ctxt().outer_expn_data().kind {
- n.as_str().contains("derive")
- } else {
- false
- }
-}