diff --git a/src/lib.rs b/src/lib.rs index 3ce5c1f9f3c..c45227f88f2 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ #![feature(plugin_registrar, box_syntax)] -#![feature(rustc_private, collections)] +#![feature(rustc_private, core, collections)] #![feature(str_split_at)] #[macro_use] @@ -8,6 +8,7 @@ extern crate syntax; extern crate rustc; // Only for the compile time checking of paths +extern crate core; extern crate collections; use rustc::plugin::Registry; diff --git a/src/methods.rs b/src/methods.rs index 6d0707ccbee..f2df736bebc 100644 --- a/src/methods.rs +++ b/src/methods.rs @@ -16,12 +16,19 @@ declare_lint!(pub STR_TO_STRING, Warn, declare_lint!(pub STRING_TO_STRING, Warn, "calling `String.to_string()` which is a no-op"); +#[allow(unused_imports)] impl LintPass for MethodsPass { fn get_lints(&self) -> LintArray { lint_array!(OPTION_UNWRAP_USED, RESULT_UNWRAP_USED, STR_TO_STRING, STRING_TO_STRING) } fn check_expr(&mut self, cx: &Context, expr: &Expr) { + { + // In case stuff gets moved around + use core::option::Option; + use core::result::Result; + use collections::string::String; + } if let ExprMethodCall(ref ident, _, ref args) = expr.node { let ref obj_ty = walk_ptrs_ty(cx.tcx.expr_ty(&*args[0])).sty; if ident.node.name == "unwrap" { diff --git a/src/types.rs b/src/types.rs index 25af398a0b4..aa5f1d13471 100644 --- a/src/types.rs +++ b/src/types.rs @@ -63,10 +63,8 @@ impl LintPass for TypePass { // In case stuff gets moved around use collections::linked_list::LinkedList as DL1; use std::collections::linked_list::LinkedList as DL2; - use std::collections::linked_list::LinkedList as DL3; } let dlists = [vec!["std","collections","linked_list","LinkedList"], - vec!["std","collections","linked_list","LinkedList"], vec!["collections","linked_list","LinkedList"]]; for path in &dlists { if match_ty_unwrap(ty, &path[..]).is_some() {