]> git.lizzy.rs Git - rust.git/commitdiff
Clean up various warnings throughout the codebase
authorAlex Crichton <alex@alexcrichton.com>
Fri, 12 Jul 2013 08:56:40 +0000 (01:56 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Sun, 14 Jul 2013 16:29:12 +0000 (09:29 -0700)
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/callee.rs
src/librustc/middle/trans/controlflow.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/mod.rs
src/libsyntax/ext/pipes/proto.rs

index 1173fa4941963c79d0f55580b448aaddca5c5c37..6d3f5d50b4b7f8f55de4f0bf3559e2906d163e85 100644 (file)
@@ -1428,7 +1428,7 @@ pub fn with_scope(bcx: block,
 
 pub fn with_scope_result(bcx: block,
                          opt_node_info: Option<NodeInfo>,
-                         name: &str,
+                         _name: &str,
                          f: &fn(block) -> Result) -> Result {
     let _icx = push_ctxt("with_scope_result");
 
index 7b7989879a639a4758e2db95bbe2dc46a3f9cc41..42f6a4dad6b74b3779831eb265b259721e86b04e 100644 (file)
@@ -197,7 +197,7 @@ fn get_impl_resolutions(bcx: block,
                         impl_id: ast::def_id)
                          -> typeck::vtable_res {
     if impl_id.crate == ast::local_crate {
-        *bcx.ccx().maps.vtable_map.get(&impl_id.node)
+        bcx.ccx().maps.vtable_map.get_copy(&impl_id.node)
     } else {
         // XXX: This is a temporary hack to work around not properly
         // exporting information about resolutions for impls.
@@ -670,15 +670,13 @@ pub fn trans_call_inner(in_cx: block,
             None => { assert!(ty::type_is_immediate(bcx.tcx(), ret_ty)) }
             Some(expr::Ignore) => {
                 // drop the value if it is not being saved.
-                unsafe {
-                    if ty::type_needs_drop(bcx.tcx(), ret_ty) {
-                        if ty::type_is_immediate(bcx.tcx(), ret_ty) {
-                            let llscratchptr = alloc_ty(bcx, ret_ty, "__ret");
-                            Store(bcx, llresult, llscratchptr);
-                            bcx = glue::drop_ty(bcx, llscratchptr, ret_ty);
-                        } else {
-                            bcx = glue::drop_ty(bcx, llretslot, ret_ty);
-                        }
+                if ty::type_needs_drop(bcx.tcx(), ret_ty) {
+                    if ty::type_is_immediate(bcx.tcx(), ret_ty) {
+                        let llscratchptr = alloc_ty(bcx, ret_ty, "__ret");
+                        Store(bcx, llresult, llscratchptr);
+                        bcx = glue::drop_ty(bcx, llscratchptr, ret_ty);
+                    } else {
+                        bcx = glue::drop_ty(bcx, llretslot, ret_ty);
                     }
                 }
             }
index 81260428f241bc06e814971ef0342c8fd918f7e0..e03a6e7c167cc4289eadeaf80856e96ead9c6ed3 100644 (file)
@@ -254,7 +254,7 @@ pub fn trans_break_cont(bcx: block,
     // Locate closest loop block, outputting cleanup as we go.
     let mut unwind = bcx;
     let mut cur_scope = unwind.scope;
-    let mut target = unwind;
+    let mut target;
     loop {
         cur_scope = match cur_scope {
             Some(@scope_info {
index a79f08b33c937d2b8296870aaa7cfc2d7c792f36..8e23f5431bcee63cc27218784981d6085dba4f40 100644 (file)
@@ -3621,25 +3621,29 @@ pub fn trait_method_def_ids(cx: ctxt, id: ast::def_id) -> @~[def_id] {
 }
 
 pub fn impl_trait_ref(cx: ctxt, id: ast::def_id) -> Option<@TraitRef> {
-    *do cx.impl_trait_cache.find_or_insert_with(id) |_| {
-        if id.crate == ast::local_crate {
-            debug!("(impl_trait_ref) searching for trait impl %?", id);
-            match cx.items.find(&id.node) {
-                Some(&ast_map::node_item(@ast::item {
-                                         node: ast::item_impl(_, ref opt_trait, _, _),
-                                         _},
-                                         _)) => {
-                    match opt_trait {
-                        &Some(ref t) => Some(ty::node_id_to_trait_ref(cx, t.ref_id)),
-                        &None => None
-                    }
+    match cx.impl_trait_cache.find(&id) {
+        Some(&ret) => { return ret; }
+        None => {}
+    }
+    let ret = if id.crate == ast::local_crate {
+        debug!("(impl_trait_ref) searching for trait impl %?", id);
+        match cx.items.find(&id.node) {
+            Some(&ast_map::node_item(@ast::item {
+                                     node: ast::item_impl(_, ref opt_trait, _, _),
+                                     _},
+                                     _)) => {
+                match opt_trait {
+                    &Some(ref t) => Some(ty::node_id_to_trait_ref(cx, t.ref_id)),
+                    &None => None
                 }
-                _ => None
             }
-        } else {
-            csearch::get_impl_trait(cx, id)
+            _ => None
         }
-    }
+    } else {
+        csearch::get_impl_trait(cx, id)
+    };
+    cx.impl_trait_cache.insert(id, ret);
+    return ret;
 }
 
 pub fn ty_to_def_id(ty: t) -> Option<ast::def_id> {
index 6f5dde74b5c10909b56acb79c0700295771a7be1..b8b8ab3145d54fb2a1eac141f034a8989016fd56 100644 (file)
@@ -303,7 +303,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
     let tcx = ccx.tcx;
     let main_t = ty::node_id_to_type(tcx, main_id);
     match ty::get(main_t).sty {
-        ty::ty_bare_fn(ref fn_ty) => {
+        ty::ty_bare_fn(*) => {
             match tcx.items.find(&main_id) {
                 Some(&ast_map::node_item(it,_)) => {
                     match it.node {
index 75424b60390d733ea33f64799733ed76eaae81db..5866b8a5af55d51f563a29c461b4c9133cbfa15e 100644 (file)
@@ -144,7 +144,8 @@ pub struct protocol_ {
 impl protocol_ {
     /// Get a state.
     pub fn get_state(&self, name: &str) -> state {
-        *self.states.iter().find_(|i| name == i.name).get()
+        let mut i = self.states.iter();
+        *i.find_(|i| name == i.name).get()
     }
 
     pub fn get_state_by_id(&self, id: uint) -> state { self.states[id] }