diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2014-09-17 00:33:36 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2014-09-17 00:33:36 +0530 |
commit | f0b8391762f37a6e50dfb7a46b461fc8f9414d57 (patch) | |
tree | 4c877ec33a4655c96d822b4367285efba614f009 | |
parent | d241826987a1f701452eb95fc50603d5aba8c890 (diff) | |
download | servo-f0b8391762f37a6e50dfb7a46b461fc8f9414d57.tar.gz servo-f0b8391762f37a6e50dfb7a46b461fc8f9414d57.zip |
Address review comments
-rw-r--r-- | components/macros/lib.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/components/macros/lib.rs b/components/macros/lib.rs index c2af641f165..1ce4832b19a 100644 --- a/components/macros/lib.rs +++ b/components/macros/lib.rs @@ -62,14 +62,11 @@ impl LintPass for TransmutePass { } fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) { - let ty = match ty.node { - ast::TyBox(ref t) | ast::TyUniq(ref t) | - ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) | - ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => &**t, - _ => ty - }; - match ty.node { - ast::TyPath(_, _, id) => { + match ty.node { + ast::TyBox(ref t) | ast::TyUniq(ref t) | + ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) | + ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => lint_unrooted_ty(cx, &**t, warning), + ast::TyPath(_, _, id) => { match cx.tcx.def_map.borrow().get_copy(&id) { def::DefTy(def_id) => { if ty::has_attr(cx.tcx, def_id, "must_root") { @@ -80,7 +77,7 @@ fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) { } } _ => (), - } + }; } impl LintPass for UnrootedPass { @@ -125,7 +122,7 @@ impl LintPass for UnrootedPass { ast::DefaultBlock => { for arg in decl.inputs.iter() { lint_unrooted_ty(cx, &*arg.ty, - "Type must be rooted, use #[must_root] on the struct definition to propagate") + "Type must be rooted, use #[must_root] on the fn definition to propagate") } } _ => () // fn is `unsafe` |