]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/borrowck/check_loans.rs
Replace all ~"" with "".to_owned()
[rust.git] / src / librustc / middle / borrowck / check_loans.rs
index 6b8af3cbc53ae76b2155dc0c108a5b30b771104e..5e0425141ac82e64f5e806f1df7150aaefe26d71 100644 (file)
@@ -240,7 +240,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
             if restr.loan_path != loan2.loan_path { continue; }
 
             let old_pronoun = if new_loan.loan_path == old_loan.loan_path {
-                ~"it"
+                "it".to_owned()
             } else {
                 format!("`{}`",
                         self.bccx.loan_path_to_str(old_loan.loan_path))
@@ -378,11 +378,7 @@ pub fn check_if_path_is_moved(&self,
     pub fn check_assignment(&self, expr: &ast::Expr) {
         // We don't use cat_expr() here because we don't want to treat
         // auto-ref'd parameters in overloaded operators as rvalues.
-        let adj = {
-            let adjustments = self.bccx.tcx.adjustments.borrow();
-            adjustments.get().find_copy(&expr.id)
-        };
-        let cmt = match adj {
+        let cmt = match self.bccx.tcx.adjustments.borrow().find_copy(&expr.id) {
             None => self.bccx.cat_expr_unadjusted(expr),
             Some(adj) => self.bccx.cat_expr_autoderefd(expr, adj)
         };
@@ -452,10 +448,7 @@ fn mark_variable_as_used_mut(this: &CheckLoanCtxt,
                        cmt.repr(this.tcx()));
                 match cmt.cat {
                     mc::cat_local(id) | mc::cat_arg(id) => {
-                        let mut used_mut_nodes = this.tcx()
-                                                     .used_mut_nodes
-                                                     .borrow_mut();
-                        used_mut_nodes.get().insert(id);
+                        this.tcx().used_mut_nodes.borrow_mut().insert(id);
                         return;
                     }
 
@@ -717,7 +710,7 @@ fn check_move_out_from_id(&self, id: ast::NodeId, span: Span) {
     fn check_captured_variables(&self,
                                 closure_id: ast::NodeId,
                                 span: Span) {
-        for cap_var in self.bccx.capture_map.get(&closure_id).deref().iter() {
+        for cap_var in self.bccx.capture_map.get(&closure_id).iter() {
             let var_id = ast_util::def_id_of_def(cap_var.def).node;
             let var_path = @LpVar(var_id);
             self.check_if_path_is_moved(closure_id, span,
@@ -839,11 +832,11 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>,
         this.check_call(expr, None, expr.span, args.as_slice());
       }
       ast::ExprIndex(_, rval) | ast::ExprBinary(_, _, rval)
-      if method_map.get().contains_key(&MethodCall::expr(expr.id)) => {
+      if method_map.contains_key(&MethodCall::expr(expr.id)) => {
         this.check_call(expr, None, expr.span, [rval]);
       }
       ast::ExprUnary(_, _) | ast::ExprIndex(_, _)
-      if method_map.get().contains_key(&MethodCall::expr(expr.id)) => {
+      if method_map.contains_key(&MethodCall::expr(expr.id)) => {
         this.check_call(expr, None, expr.span, []);
       }
       ast::ExprInlineAsm(ref ia) => {