]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/check_const.rs
Replace all ~"" with "".to_owned()
[rust.git] / src / librustc / middle / check_const.rs
index 6bec35665fbd7d3c45a90a39a75b27a84f6ef724..67f3b8fe90654638880a89e6b63eec29a6abe224 100644 (file)
@@ -103,7 +103,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr, is_const: bool) {
           ExprLit(lit) if ast_util::lit_is_str(lit) => {}
           ExprBinary(..) | ExprUnary(..) => {
             let method_call = typeck::MethodCall::expr(e.id);
-            if v.method_map.borrow().get().contains_key(&method_call) {
+            if v.method_map.borrow().contains_key(&method_call) {
                 v.tcx.sess.span_err(e.span, "user-defined operators are not \
                                              allowed in constant expressions");
             }
@@ -112,7 +112,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr, is_const: bool) {
           ExprCast(_, _) => {
             let ety = ty::expr_ty(v.tcx, e);
             if !ty::type_is_numeric(ety) && !ty::type_is_unsafe_ptr(ety) {
-                v.tcx.sess.span_err(e.span, ~"can not cast to `" +
+                v.tcx.sess.span_err(e.span, "can not cast to `".to_owned() +
                                               ppaux::ty_to_str(v.tcx, ety) +
                                              "` in a constant expression");
             }
@@ -127,7 +127,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr, is_const: bool) {
                                     "paths in constants may only refer to \
                                      items without type parameters");
             }
-            match v.def_map.borrow().get().find(&e.id) {
+            match v.def_map.borrow().find(&e.id) {
               Some(&DefStatic(..)) |
               Some(&DefFn(_, _)) |
               Some(&DefVariant(_, _, _)) |
@@ -145,7 +145,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr, is_const: bool) {
             }
           }
           ExprCall(callee, _) => {
-            match v.def_map.borrow().get().find(&callee.id) {
+            match v.def_map.borrow().find(&callee.id) {
                 Some(&DefStruct(..)) => {}    // OK.
                 Some(&DefVariant(..)) => {}    // OK.
                 _ => {
@@ -157,7 +157,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr, is_const: bool) {
           }
           ExprVstore(_, ExprVstoreMutSlice) |
           ExprVstore(_, ExprVstoreSlice) |
-          ExprVec(_, MutImmutable) |
+          ExprVec(_) |
           ExprAddrOf(MutImmutable, _) |
           ExprParen(..) |
           ExprField(..) |
@@ -221,8 +221,7 @@ fn visit_item(&mut self, it: &Item, _: ()) {
     fn visit_expr(&mut self, e: &Expr, _: ()) {
         match e.node {
             ExprPath(..) => {
-                let def_map = self.def_map.borrow();
-                match def_map.get().find(&e.id) {
+                match self.def_map.borrow().find(&e.id) {
                     Some(&DefStatic(def_id, _)) if
                             ast_util::is_local(def_id) => {
                         self.visit_item(self.ast_map.expect_item(def_id.node), ());