aboutsummaryrefslogtreecommitdiffstats
path: root/components/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'components/plugins')
-rw-r--r--components/plugins/lib.rs4
-rw-r--r--components/plugins/lints/transmute_type.rs4
-rw-r--r--components/plugins/utils.rs25
3 files changed, 4 insertions, 29 deletions
diff --git a/components/plugins/lib.rs b/components/plugins/lib.rs
index a2babd3bfab..9ee553145a5 100644
--- a/components/plugins/lib.rs
+++ b/components/plugins/lib.rs
@@ -39,7 +39,7 @@ pub mod lints;
/// Autogenerates implementations of Reflectable on DOM structs
pub mod reflector;
/// Utilities for writing plugins
-pub mod utils;
+mod utils;
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
@@ -63,5 +63,5 @@ fn register_clippy(reg: &mut Registry) {
::clippy::plugin_registrar(reg);
}
#[cfg(not(feature = "clippy"))]
-fn register_clippy(reg: &mut Registry) {
+fn register_clippy(_reg: &mut Registry) {
}
diff --git a/components/plugins/lints/transmute_type.rs b/components/plugins/lints/transmute_type.rs
index 8f9f4d7ce6b..ef2806f5f2f 100644
--- a/components/plugins/lints/transmute_type.rs
+++ b/components/plugins/lints/transmute_type.rs
@@ -28,8 +28,8 @@ impl LateLintPass for TransmutePass {
match expr.node {
hir::ExprPath(_, ref path) => {
if path.segments.last()
- .map_or(false, |ref segment| segment.identifier.name.as_str() == "transmute")
- && args.len() == 1 {
+ .map_or(false, |ref segment| segment.identifier.name.as_str() == "transmute") &&
+ args.len() == 1 {
let tcx = cx.tcx;
cx.span_lint(TRANSMUTE_TYPE_LINT, ex.span,
&format!("Transmute to {:?} from {:?} detected",
diff --git a/components/plugins/utils.rs b/components/plugins/utils.rs
index b514e967d5b..3b96bedd0f1 100644
--- a/components/plugins/utils.rs
+++ b/components/plugins/utils.rs
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use rustc::hir::def_id::DefId;
-use rustc::hir::map as ast_map;
use rustc::hir::{self, def};
use rustc::lint::{LateContext, LintContext};
use syntax::ast;
@@ -73,30 +72,6 @@ pub fn match_lang_did(cx: &LateContext, did: DefId, value: &str) -> bool {
})
}
-// Determines if a block is in an unsafe context so that an unhelpful
-// lint can be aborted.
-pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool {
- match map.find(map.get_parent(id)) {
- Some(ast_map::NodeImplItem(itm)) => {
- match itm.node {
- hir::ImplItemKind::Method(ref sig, _) => sig.unsafety == hir::Unsafety::Unsafe,
- _ => false
- }
- },
- Some(ast_map::NodeItem(itm)) => {
- match itm.node {
- hir::ItemFn(_, style, _, _, _, _) => match style {
- hir::Unsafety::Unsafe => true,
- _ => false,
- },
- _ => false,
- }
- }
- _ => false // There are probably a couple of other unsafe cases we don't care to lint, those will need
- // to be added.
- }
-}
-
/// check if a DefId's path matches the given absolute type path
/// usage e.g. with
/// `match_def_path(cx, id, &["core", "option", "Option"])`