fixed renaming of rustc::middle::ty enums
This commit is contained in:
20
src/misc.rs
20
src/misc.rs
@@ -4,7 +4,7 @@ use syntax::ast::*;
|
||||
use syntax::ast_util::{is_comparison_binop, binop_to_string};
|
||||
use syntax::visit::{FnKind};
|
||||
use rustc::lint::{Context, LintPass, LintArray, Lint, Level};
|
||||
use rustc::middle::ty::{self, expr_ty, ty_str, ty_ptr, ty_rptr, ty_float};
|
||||
use rustc::middle::ty::{self, expr_ty};
|
||||
use syntax::codemap::{Span, Spanned};
|
||||
|
||||
use types::span_note_and_lint;
|
||||
@@ -12,7 +12,7 @@ use utils::match_path;
|
||||
|
||||
pub fn walk_ty<'t>(ty: ty::Ty<'t>) -> ty::Ty<'t> {
|
||||
match ty.sty {
|
||||
ty_ptr(ref tm) | ty_rptr(_, ref tm) => walk_ty(tm.ty),
|
||||
ty::TyRef(_, ref tm) | ty::TyRawPtr(ref tm) => walk_ty(tm.ty),
|
||||
_ => ty
|
||||
}
|
||||
}
|
||||
@@ -79,10 +79,10 @@ impl LintPass for StrToStringPass {
|
||||
}
|
||||
|
||||
fn is_str(cx: &Context, expr: &ast::Expr) -> bool {
|
||||
match walk_ty(expr_ty(cx.tcx, expr)).sty {
|
||||
ty_str => true,
|
||||
_ => false
|
||||
}
|
||||
match walk_ty(expr_ty(cx.tcx, expr)).sty {
|
||||
ty::TyStr => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,11 @@ impl LintPass for FloatCmp {
|
||||
}
|
||||
|
||||
fn is_float(cx: &Context, expr: &Expr) -> bool {
|
||||
if let ty_float(_) = walk_ty(expr_ty(cx.tcx, expr)).sty { true } else { false }
|
||||
if let ty::TyFloat(_) = walk_ty(expr_ty(cx.tcx, expr)).sty {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
declare_lint!(pub PRECEDENCE, Warn,
|
||||
@@ -263,6 +267,6 @@ fn check_to_owned(cx: &Context, expr: &Expr, other_span: Span) {
|
||||
}
|
||||
|
||||
fn is_str_arg(cx: &Context, args: &[P<Expr>]) -> bool {
|
||||
args.len() == 1 && if let ty_str =
|
||||
args.len() == 1 && if let ty::TyStr =
|
||||
walk_ty(expr_ty(cx.tcx, &*args[0])).sty { true } else { false }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user